This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtestlightsku.html
102 lines (94 loc) · 3.49 KB
/
testlightsku.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<html>
<!-- Light SKU CDN. Use this SKU if you are running in environment with no DOM access.
SKU functionlity is limited. It does not have curated apis for supported schemas
in Application Insights and auto collection of data. -->
<script type="text/javascript" src="https://az416426.vo.msecnd.net/next/aib.2.min.js"></script>
<head>
<div>
Light SKU test
</div>
</head>
<br/>
<script type="text/javascript">
var appInsights = new Microsoft.ApplicationInsights.ApplicationInsights({instrumentationKey: "INSTRUMENTATION_KEY"});
</script>
<script>
function onPageViewClick() {
var pageView = {
name: "Microsoft.ApplicationInsights.AABA40BC-EB0D-44A7-96F5-ED2103E47AE9.Pageview",
ext: {
"user": { "id": "test" }
},
tags: [ { "device.id": "AABA40BC-EB0D-44A7-96F5-ED2103E47AE9"} ],
data: {
"custom data": {
"data1": "value1"
}
},
baseType: "PageviewData",
baseData: {
name: "Test Page",
uri: "http://localhost:8080/testlightsku.html"
} // please refer to types/*.d.ts exported in library for full set of properties supported here
};
appInsights.core.track(pageView); // track a page view
appInsights.flush(); // to see data sent immediately
}
function onCustomEventClick() {
var eventItem = {
"name": "Microsoft.ApplicationInsights.INSTRUMENTATION_KEY_NO_SEPARATOR.Event",
"timestamp": "2018-07-19T02:17:12.993Z",
"ext": {},
"tags": [],
"data": {
"cProp1Key": "cProp1Val",
"cProp2Key": "cProp2Val",
"cMeasurement1Key": 4.8
},
baseType:"EventData", // defined types
baseData: {
"name": "testing",
"properties": {
"data1": "value1"
},
"measurements": {
"data1": 2000
}
}
};
appInsights.core.track(eventItem);
appInsights.flush();
}
function trackUnhandledException() {
var exceptionItem = {
"name": "Microsoft.ApplicationInsights.8e68dc94-34d1-4894-8697-be2ba6282b5b.Event",
"timestamp": "2018-07-19T02:17:12.993Z",
"ext": {},
"tags": [],
"data": {
"cProp1Key": "cProp1Val",
"cProp2Key": "cProp2Val",
"cMeasurement1Key": 4.8
},
baseType:"ExceptionData", // defined types
baseData: {
name: "Exception Item",
error: new Error("Test exception"),
properties: {
"Test": "Scenario foo"
},
"measurements": {
"data1": 2000
}
}
};
appInsights.core.track(exceptionItem);
appInsights.flush();
}
</script>
<body>
<button style="margin:10px" onclick="onPageViewClick()">Page View</button>
<button style="margin:10px" onclick="onCustomEventClick()">Custom Event</button>
<button style="margin:10px" onclick="trackUnhandledException()">Track exception</button>
</body>
</html>