@@ -3,10 +3,11 @@ import { version } from './version';
3
3
import { Environment , EnvironmentType } from "@microsoft/sp-core-library" ;
4
4
5
5
const controlType = "react" ;
6
+ const iKey = "9f59b81e-d2ed-411e-a961-8bcf3f7f04d0" ;
6
7
7
8
if ( typeof AppInsights !== "undefined" ) {
8
9
AppInsights . downloadAndSetup ( {
9
- instrumentationKey : "9f59b81e-d2ed-411e-a961-8bcf3f7f04d0" ,
10
+ instrumentationKey : iKey ,
10
11
disableExceptionTracking : true ,
11
12
disableAjaxTracking : true
12
13
} ) ;
@@ -21,20 +22,23 @@ if (typeof appInsights !== "undefined") {
21
22
22
23
// Filter out telemetry data
23
24
appInsights . context . addTelemetryInitializer ( ( envelope : Microsoft . ApplicationInsights . IEnvelope ) => {
24
- const telemetryItem = envelope . data . baseData ;
25
- // Only send telemetry data if it contains data of this library
26
- if ( ! telemetryItem . properties || ! telemetryItem . properties . controlType ) {
27
- return false ;
28
- }
25
+ // Only run this telemetry initializer for the PnP controls
26
+ if ( envelope . iKey === iKey ) {
27
+ const telemetryItem = envelope . data . baseData ;
28
+ // Only send telemetry data if it contains data of this library
29
+ if ( ! telemetryItem . properties || ! telemetryItem . properties . controlType ) {
30
+ return false ;
31
+ }
29
32
30
- // Check if the type of data is only EventData, otherwise this may not be sent
31
- if ( envelope . data && envelope . data . baseType !== "EventData" ) {
32
- return false ;
33
- }
33
+ // Check if the type of data is only EventData, otherwise this may not be sent
34
+ if ( envelope . data && envelope . data . baseType !== "EventData" ) {
35
+ return false ;
36
+ }
34
37
35
- // Only send telemetry if it is coming from the right control type
36
- if ( telemetryItem . properties && telemetryItem . properties . controlType && telemetryItem . properties . controlType !== controlType ) {
37
- return false ;
38
+ // Only send telemetry if it is coming from the right control type
39
+ if ( telemetryItem . properties && telemetryItem . properties . controlType && telemetryItem . properties . controlType !== controlType ) {
40
+ return false ;
41
+ }
38
42
}
39
43
} ) ;
40
44
} ) ;
0 commit comments