You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 22, 2019. It is now read-only.
Javascript module to include [Application Insights][appinsights-js] in applications built with [React][react].
10
-
It extends Application Insights with additional React-specific features:
11
-
* tracking of router changes
12
-
* React components usage statistics
13
-
* API to extend the standard telemetry with additional dimensions
3
+
[](https://www.npmjs.com/package/react-appinsights)[](https://dev.azure.com/azure-public/react-appinsights/_build/latest?definitionId=16)[](https://greenkeeper.io/)[](https://www.npmjs.com/package/react-appinsights)
4
+
5
+
Javascript library to integrate [Application Insights][appinsights-js] in applications built with [React][react].
6
+
`react-appinsights` extends Application Insights with additional React-specific features:
7
+
8
+
- tracking of router changes
9
+
- React components usage statistics
10
+
- API to extend the standard telemetry with additional dimensions
14
11
15
12
## Installation
16
13
17
-
With npm:
14
+
Using npm:
15
+
18
16
```bash
19
-
npm install --save react-appinsights
17
+
npm install --save react-appinsights@beta
20
18
```
21
19
22
20
## Usage
23
21
24
-
To initialize Application Insights add the following to the entry point
25
-
file of your application (e.g. index.js):
22
+
To initialize Application Insights, add the following to the entry point
It will measure time from the `ComponentDidMount` event through the `ComponentWillUnmount` event.
80
-
However, in order to make this time more accurate it will subtract idle time.
81
-
In other words, `React Component Engaged Time = ComponentWillUnmount timestamp - ComponentDidMount timestamp - idle time`.
104
+
It will measure time from the `ComponentDidMount` event through the `ComponentWillUnmount` event.
105
+
However, in order to make this more accurate, it will subtract the time in which the user was idle.
106
+
In other words, `React Component Engaged Time = ComponentWillUnmount timestamp - ComponentDidMount timestamp - idle time`.
107
+
108
+
To see this metric in the Azure portal you need to navigate to the Application Insights resource, select "Metrics" tab and configure the empty charts to display Custom metric named "React Component Engaged Time (seconds)", select aggregation (sum, avg, etc.) of your liking and apply split by "Component Name".
You can also run custom queries to slice and dice AI data to generate reports and visualizations as per your requirements. In the Azure portal, navigate to the Application Insights resource, select "Analytics" from the top menu of the Overview tab and run your query.
82
113
83
-
To see this metric in Azure portal you need to navigate to Application Insights resource,
84
-
select Metrics Explorer from the top menu
85
-
and configure one of the empty charts to display Custom metrics "React Component Engaged Time"
86
-
grouped by Component Name.
87
-
It can take up to 10 minutes for new custom metric to appear in Azure Portal.
0 commit comments