Skip to content

Commit d237345

Browse files
committed
update to JavaScript extensions
1 parent 2e866a3 commit d237345

File tree

3 files changed

+28
-24
lines changed

3 files changed

+28
-24
lines changed

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ms.reviewer: mmcc
1111

1212
# Feature extensions for Application Insights JavaScript SDK (Click Analytics)
1313

14-
App Insights JavaScript SDK feature extensions are additional features that can be added to the Application Insights JavaScript SDK to enhance its functionality.
14+
App Insights JavaScript SDK feature extensions are extra features that can be added to the Application Insights JavaScript SDK to enhance its functionality.
1515

1616
In this article, we cover the Click Analytics plugin that automatically tracks click events on web pages and uses data-* attributes on HTML elements to populate event telemetry.
1717

@@ -88,19 +88,19 @@ appInsights.loadAppInsights();
8888

8989
1. Telemetry data generated from the click events are stored as `customEvents` in the Application Insights section of the Azure portal.
9090
2. The `name` of the customEvent is populated based on the following rules:
91-
1. The `id` provided in the `data-*-id` will be used as the customEvent name. For example, if the clicked HTML element has the attribute "data-sample-id"="button1", then "button1" will be the customEvent name.
92-
2. If no such attribute exists and if the `useDefaultContentNameOrId` is set to `true` in the configuration, then the clicked element's HTML attribute `id` or content name of the element will be used as the customEvent name. If both `id` and content name are present, precedence is given to `id`.
93-
3. If `useDefaultContentNameOrId` is false, then the customEvent name will be "not_specified".
91+
1. The `id` provided in the `data-*-id` is used as the customEvent name. For example, if the clicked HTML element has the attribute "data-sample-id"="button1", then "button1" is the customEvent name.
92+
2. If no such attribute exists and if the `useDefaultContentNameOrId` is set to `true` in the configuration, then the clicked element's HTML attribute `id` or content name of the element is used as the customEvent name. If both `id` and content name are present, precedence is given to `id`.
93+
3. If `useDefaultContentNameOrId` is false, then the customEvent name is "not_specified".
9494

9595
> [!TIP]
96-
> Our recommendations is to set `useDefaultContentNameOrId` to true for generating meaningful data.
96+
> We recommend settings `useDefaultContentNameOrId` to true for generating meaningful data.
9797
3. `parentDataTag` does two things:
98-
1. If this tag is present, the plugin will fetch the `data-*` attributes and values from all the parent HTML elements of the clicked element.
99-
2. To improve efficiency, the plugin uses this tag as a flag, when encountered it will stop itself from further processing the DOM (Document Object Model) upwards.
98+
1. If this tag is present, the plugin fetches the `data-*` attributes and values from all the parent HTML elements of the clicked element.
99+
2. To improve efficiency, the plugin uses this tag as a flag, when encountered it stops itself from further processing the DOM (Document Object Model) upwards.
100100

101101
> [!CAUTION]
102102
> Once `parentDataTag` is used, the SDK will begin looking for parent tags across your entire application and not just the HTML element where you used it.
103-
4. `customDataPrefix` provided by the user should always start with `data-`, for example `data-sample-`. In HTML, the `data-*` global attributes are called custom data attributes, that allow proprietary information to be exchanged between the HTML and its DOM representation by scripts. Older browsers (Internet Explorer, Safari) will drop attributes that it doesn't understand, unless they start with `data-`.
103+
4. `customDataPrefix` provided by the user should always start with `data-`, for example `data-sample-`. In HTML, the `data-*` global attributes are called custom data attributes that allow proprietary information to be exchanged between the HTML and its DOM representation by scripts. Older browsers (Internet Explorer, Safari) drop attributes that it doesn't understand, unless they start with `data-`.
104104

105105
The `*` in `data-*` may be replaced by any name following the [production rule of XML names](https://www.w3.org/TR/REC-xml/#NT-Name) with the following restrictions:
106106
- The name must not start with "xml", whatever case is used for these letters.
@@ -124,7 +124,7 @@ The following are some of the key properties captured by default when the plugin
124124
| actionType | Action type that caused the click event. Can be left or right click. | CL |
125125
| baseTypeSource | Base Type source of the custom event. | ClickEvent |
126126
| clickCoordinates | Coordinates where the click event is triggered. | 659X47 |
127-
| content | Placeholder to store additional `data-*` attributes and values. | [{sample1:value1, sample2:value2}] |
127+
| content | Placeholder to store extra `data-*` attributes and values. | [{sample1:value1, sample2:value2}] |
128128
| pageName | Title of the page where the click event is triggered. | Sample Title |
129129
| parentId | ID or name of the parent element | navbarContainer |
130130

@@ -144,8 +144,8 @@ The following are some of the key properties captured by default when the plugin
144144
| urlCollectHash | Boolean | False | Enables the logging of values after a "#" character of the URL. |
145145
| urlCollectQuery | Boolean | False | Enables the logging of the query string of the URL. |
146146
| behaviorValidator | Function | Null | Callback function to use for the `data-*-bhvr` value validation. For more information, go to [behaviorValidator section](#behaviorvalidator).|
147-
| defaultRightClickBhvr | String (or) number | '' | Default Behavior value when Right Click event has occurred. This value will be overridden if the element has the `data-*-bhvr` attribute. |
148-
| dropInvalidEvents | Boolean | False | Flag to drop events that do not have useful click data. |
147+
| defaultRightClickBhvr | String (or) number | '' | Default Behavior value when Right Click event has occurred. This value is overridden if the element has the `data-*-bhvr` attribute. |
148+
| dropInvalidEvents | Boolean | False | Flag to drop events that don't have useful click data. |
149149

150150
### IValueCallback
151151

@@ -159,17 +159,17 @@ The following are some of the key properties captured by default when the plugin
159159

160160
| Name | Type | Default | Default Tag to Use in HTML | Description |
161161
|---------------------------|---------|-----------|-------------|----------------------------------------------------------------------------------------------|
162-
| useDefaultContentNameOrId | Boolean | False | N/A |Collects standard HTML attribute for contentName when a particular element is not tagged with default customDataPrefix or when customDataPrefix is not provided by user. |
162+
| useDefaultContentNameOrId | Boolean | False | N/A |Collects standard HTML attribute for contentName when a particular element isn't tagged with default customDataPrefix or when customDataPrefix isn't provided by user. |
163163
| customDataPrefix | String | `data-` | `data-*`| Automatic capture content name and value of elements that are tagged with provided prefix. For example, `data-*-id`, `data-<yourcustomattribute>` can be used in the HTML tags. |
164164
| aiBlobAttributeTag | String | `ai-blob` | `data-ai-blob`| Plugin supports a JSON blob attribute instead of individual `data-*` attributes. |
165165
| metaDataPrefix | String | Null | N/A | Automatic capture HTML Head's meta element name and content with provided prefix when capture. For example, `custom-` can be used in the HTML meta tag. |
166-
| captureAllMetaDataContent | Boolean | False | N/A | Automatic capture all HTML Head's meta element names and content. Default is false. If enabled this will override provided metaDataPrefix. |
166+
| captureAllMetaDataContent | Boolean | False | N/A | Automatic capture all HTML Head's meta element names and content. Default is false. If enabled it overrides provided metaDataPrefix. |
167167
| 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.|
168-
| dntDataTag | String | `ai-dnt` | `data-ai-dnt`| HTML elements with this attribute will be ignored by the plugin for capturing telemetry data.|
168+
| dntDataTag | String | `ai-dnt` | `data-ai-dnt`| HTML elements with this attribute are ignored by the plugin for capturing telemetry data.|
169169

170170
### behaviorValidator
171171

172-
The behaviorValidator functions automatically checks that tagged behaviors in code conform to a pre-defined list. This ensures tagged behaviors are consistent with your enterprise's established taxonomy. It is not required or expected that most Azure Monitor customers will use these functions, but they're available for advanced scenarios. There are three different behaviorValidator callback functions exposed as part of this extension. However, users can use their own callback functions if the exposed functions do not solve your requirement. The intent is to bring your own behaviors data structure, the plugin uses this validator function while extracting the behaviors from the data tags.
172+
The behaviorValidator functions automatically check that tagged behaviors in code conform to a pre-defined list. It ensures 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. There are three different behaviorValidator callback functions exposed as part of this extension. However, users can use their own callback functions if the exposed functions don't solve your requirement. The intent is to bring your own behaviors data structure, the plugin uses this validator function while extracting the behaviors from the data tags.
173173

174174
| Name | Description |
175175
| ---------------------- | -----------------------------------------------------------------------------------|
@@ -366,7 +366,7 @@ appInsights.loadAppInsights();
366366

367367
Correlation generates and sends data that enables distributed tracing and powers the [application map](../app/app-map.md), [end-to-end transaction view](../app/app-map.md#go-to-details), and other diagnostic tools.
368368

369-
In JavaScript correlation is turned off by default in order to minimize the telemetry we send by default. To enable correlation please reference [JavaScript client-side correlation documentation](./javascript.md#enable-distributed-tracing).
369+
JavaScript correlation is turned off by default in order to minimize the telemetry we send by default. To enable correlation, reference [JavaScript client-side correlation documentation](./javascript.md#enable-distributed-tracing).
370370

371371
## Sample app
372372

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Framework extensions for Application Insights JavaScript SDK
3-
description: Learn how to install and use Javascript framework extensions for the Application Insights JavaScript SDK.
3+
description: Learn how to install and use JavaScript framework extensions for the Application Insights JavaScript SDK.
44
services: azure-monitor
55
ms.tgt_pltfrm: ibiza
66
ms.topic: conceptual
@@ -13,7 +13,7 @@ ms.reviewer: mmcc
1313

1414
In addition to the core SDK, there are also plugins available for specific frameworks, such as the [React plugin](javascript-framework-extensions.md?tabs=react), the [React Native plugin](javascript-framework-extensions.md?tabs=reactnative), and the [Angular plugin](javascript-framework-extensions.md?tabs=angular).
1515

16-
These plugins provide additional functionality and integration with the specific framework.
16+
These plugins provide extra functionality and integration with the specific framework.
1717

1818
## [React](#tab/react)
1919

@@ -282,7 +282,7 @@ The React Native plugin for Application Insights JavaScript SDK collects device
282282

283283
### Requirements
284284

285-
You must be using a version >= 2.0.0 of `@microsoft/applicationinsights-web`. This plugin will only work in react-native apps. It will not work with [apps using the Expo framework](https://docs.expo.io/), therefore it will not work with Create React Native App.
285+
You must be using a version >= 2.0.0 of `@microsoft/applicationinsights-web`. This plugin works in react-native apps. It doesn't work with [apps using the Expo framework](https://docs.expo.io/), therefore it doesn't work with Create React Native App.
286286

287287
### Getting started
288288

@@ -321,11 +321,11 @@ appInsights.loadAppInsights();
321321

322322
Correlation generates and sends data that enables distributed tracing and powers the [application map](../app/app-map.md), [end-to-end transaction view](../app/app-map.md#go-to-details), and other diagnostic tools.
323323

324-
In JavaScript correlation is turned off by default in order to minimize the telemetry we send by default. To enable correlation please reference [JavaScript client-side correlation documentation](./javascript.md#enable-distributed-tracing).
324+
JavaScript correlation is turned off by default in order to minimize the telemetry we send by default. To enable correlation, reference [JavaScript client-side correlation documentation](./javascript.md#enable-distributed-tracing).
325325

326326
#### PageView
327327

328-
If a custom `PageView` duration is not provided, `PageView` duration defaults to a value of 0.
328+
If a custom `PageView` duration isn't provided, `PageView` duration defaults to a value of 0.
329329

330330

331331
## [Angular](#tab/angular)
@@ -407,7 +407,7 @@ export class AppModule { }
407407

408408
Correlation generates and sends data that enables distributed tracing and powers the [application map](../app/app-map.md), [end-to-end transaction view](../app/app-map.md#go-to-details), and other diagnostic tools.
409409

410-
In JavaScript correlation is turned off by default in order to minimize the telemetry we send by default. To enable correlation please reference [JavaScript client-side correlation documentation](./javascript.md#enable-distributed-tracing).
410+
JavaScript correlation is turned off by default in order to minimize the telemetry we send by default. To enable correlation, reference [JavaScript client-side correlation documentation](./javascript.md#enable-distributed-tracing).
411411

412412
#### Route tracking
413413

@@ -418,7 +418,7 @@ The Angular Plugin automatically tracks route changes and collects other Angular
418418
419419
#### PageView
420420

421-
If a custom `PageView` duration is not provided, `PageView` duration defaults to a value of 0.
421+
If a custom `PageView` duration isn't provided, `PageView` duration defaults to a value of 0.
422422

423423
---
424424

articles/azure-monitor/app/javascript-sdk-upgrade.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,8 @@ If you're using the current application insights PRODUCTION SDK (1.0.20) and wan
4545
});
4646
```
4747

48-
Test in an internal environment to verify the monitoring telemetry is working as expected. If all works, update your API signatures appropriately to SDK v2 and deploy in your production environments.
48+
Test in an internal environment to verify the monitoring telemetry is working as expected. If all works, update your API signatures appropriately to SDK v2 and deploy in your production environments.
49+
50+
## Next steps
51+
- To learn more about the JavaScript SDK, see the [Application Insights JavaScript SDK documentation](javascript.md).
52+
- To learn about the Kusto Query Language and querying data in Log Analytics, see the [Log query overview](../../azure-monitor/logs/log-query-overview.md).

0 commit comments

Comments
 (0)