Skip to content

Commit 757219d

Browse files
committed
Making updates based on feedback
1 parent 5c90891 commit 757219d

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

articles/azure-monitor/app/javascript-feature-extensions.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,9 @@ In this article, we cover the Click Analytics plug-in that automatically tracks
1919

2020
## Get started
2121

22-
Users can set up the Click Analytics Autocollection plug-in via npm.
22+
Users can set up the Click Analytics Auto-Collection plug-in via snippet or NPM.
2323

24-
### npm setup
25-
26-
Install the npm package:
27-
28-
```bash
29-
npm install --save @microsoft/applicationinsights-clickanalytics-js @microsoft/applicationinsights-web
30-
```
31-
32-
```js
33-
34-
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
35-
import { ClickAnalyticsPlugin } from '@microsoft/applicationinsights-clickanalytics-js';
36-
37-
const clickPluginInstance = new ClickAnalyticsPlugin();
38-
// Click Analytics configuration
39-
const clickPluginConfig = {
40-
autoCapture: true
41-
};
42-
// Application Insights Configuration
43-
const configObj = {
44-
connectionString: "YOUR CONNECTION STRING",
45-
extensions: [clickPluginInstance],
46-
extensionConfig: {
47-
[clickPluginInstance.identifier]: clickPluginConfig
48-
},
49-
};
50-
51-
const appInsights = new ApplicationInsights({ config: configObj });
52-
appInsights.loadAppInsights();
53-
```
54-
55-
## Snippet setup
24+
### Snippet setup
5625

5726
Ignore this setup if you use the npm setup.
5827

@@ -86,6 +55,37 @@ Ignore this setup if you use the npm setup.
8655
</script>
8756
```
8857

58+
### npm setup
59+
60+
Install the npm package:
61+
62+
```bash
63+
npm install --save @microsoft/applicationinsights-clickanalytics-js @microsoft/applicationinsights-web
64+
```
65+
66+
```js
67+
68+
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
69+
import { ClickAnalyticsPlugin } from '@microsoft/applicationinsights-clickanalytics-js';
70+
71+
const clickPluginInstance = new ClickAnalyticsPlugin();
72+
// Click Analytics configuration
73+
const clickPluginConfig = {
74+
autoCapture: true
75+
};
76+
// Application Insights Configuration
77+
const configObj = {
78+
connectionString: "YOUR CONNECTION STRING",
79+
extensions: [clickPluginInstance],
80+
extensionConfig: {
81+
[clickPluginInstance.identifier]: clickPluginConfig
82+
},
83+
};
84+
85+
const appInsights = new ApplicationInsights({ config: configObj });
86+
appInsights.loadAppInsights();
87+
```
88+
8989
## Use the plug-in
9090

9191
1. Telemetry data generated from the click events are stored as `customEvents` in the Application Insights section of the Azure portal.
@@ -113,14 +113,14 @@ Ignore this setup if you use the npm setup.
113113

114114
The following key properties are captured by default when the plug-in is enabled.
115115

116-
#### Custom event properties
116+
### Custom event properties
117117
| Name | Description | Sample |
118118
| --------------------- | ---------------------------------------|-----------------|
119119
| Name | The name of the custom event. More information on how a name gets populated is shown in the [preceding section](#use-the-plug-in).| About |
120120
| itemType | Type of event. | customEvent |
121121
|sdkVersion | Version of Application Insights SDK along with click plug-in.|JavaScript:2.6.2_ClickPlugin2.6.2|
122122

123-
#### Custom dimensions
123+
### Custom dimensions
124124
| Name | Description | Sample |
125125
| --------------------- | ---------------------------------------|-----------------|
126126
| actionType | Action type that caused the click event. It can be a left or right click. | CL |
@@ -130,7 +130,7 @@ The following key properties are captured by default when the plug-in is enabled
130130
| pageName | Title of the page where the click event is triggered. | Sample Title |
131131
| parentId | ID or name of the parent element. | navbarContainer |
132132

133-
#### Custom measurements
133+
### Custom measurements
134134
| Name | Description | Sample |
135135
| --------------------- | ---------------------------------------|-----------------|
136136
| timeToAction | Time taken in milliseconds for the user to click the element since the initial page load. | 87407 |
@@ -149,15 +149,15 @@ The following key properties are captured by default when the plug-in is enabled
149149
| defaultRightClickBhvr | String (or) number | '' | Default behavior value when a right-click event has occurred. This value is overridden if the element has the `data-*-bhvr` attribute. |
150150
| dropInvalidEvents | Boolean | False | Flag to drop events that don't have useful click data. |
151151

152-
#### IValueCallback
152+
### IValueCallback
153153

154154
| Name | Type | Default | Description |
155155
| ------------------ | -------- | ------- | --------------------------------------------------------------------------------------- |
156156
| pageName | Function | Null | Function to override the default `pageName` capturing behavior. |
157157
| pageActionPageTags | Function | Null | A callback function to augment the default `pageTags` collected during a `pageAction` event. |
158158
| contentName | Function | Null | A callback function to populate customized `contentName`. |
159159

160-
#### ICustomDataTags
160+
### ICustomDataTags
161161

162162
| Name | Type | Default | Default tag to use in HTML | Description |
163163
|---------------------------|---------|-----------|-------------|----------------------------------------------------------------------------------------------|
@@ -169,7 +169,7 @@ The following key properties are captured by default when the plug-in is enabled
169169
| parentDataTag | String | Null | N/A | Stops traversing up the DOM to capture content name and value of elements when encountered with this tag. For example, `data-<yourparentDataTag>` can be used in the HTML tags.|
170170
| dntDataTag | String | `ai-dnt` | `data-ai-dnt`| The plug-in for capturing telemetry data ignores HTML elements with this attribute.|
171171

172-
#### behaviorValidator
172+
### behaviorValidator
173173

174174
The `behaviorValidator` functions automatically check that tagged behaviors in code conform to a predefined list. The functions ensure that tagged behaviors are consistent with your enterprise's established taxonomy. It isn't required or expected that most Azure Monitor customers use these functions, but they're available for advanced scenarios.
175175

@@ -181,7 +181,7 @@ Three different `behaviorValidator` callback functions are exposed as part of th
181181
| BehaviorMapValidator | Use this callback function if your behavior's data structure is a dictionary. |
182182
| BehaviorEnumValidator | Use this callback function if your behavior's data structure is an Enum. |
183183

184-
##### Sample usage with behaviorValidator
184+
#### Sample usage with behaviorValidator
185185

186186
```js
187187
var clickPlugin = Microsoft.ApplicationInsights.ClickAnalyticsPlugin;

0 commit comments

Comments
 (0)