@microsoft/applicationinsights-clickanalytics-js 3.0.0-beta.2303-11 → 3.0.0-nightly3.2304-28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{ai.clck.3.0.0-beta.2303-11.cjs.js → es5/ai.clck.3.0.0-nightly3.2304-28.cjs.js} +810 -786
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.cjs.js.map +1 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.cjs.min.js +6 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.cjs.min.js.map +1 -0
- package/browser/{ai.clck.3.0.0-beta.2303-11.gbl.js → es5/ai.clck.3.0.0-nightly3.2304-28.gbl.js} +809 -785
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.gbl.js.map +1 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.gbl.min.js +6 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.gbl.min.js.map +1 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.integrity.json +66 -0
- package/browser/{ai.clck.3.0.0-beta.2303-11.js → es5/ai.clck.3.0.0-nightly3.2304-28.js} +809 -785
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.js.map +1 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.min.js +6 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.min.js.map +1 -0
- package/browser/{ai.clck.3.cjs.js → es5/ai.clck.3.cjs.js} +809 -785
- package/browser/es5/ai.clck.3.cjs.js.map +1 -0
- package/browser/es5/ai.clck.3.cjs.min.js +6 -0
- package/browser/es5/ai.clck.3.cjs.min.js.map +1 -0
- package/browser/{ai.clck.3.gbl.js → es5/ai.clck.3.gbl.js} +808 -784
- package/browser/es5/ai.clck.3.gbl.js.map +1 -0
- package/browser/es5/ai.clck.3.gbl.min.js +6 -0
- package/browser/es5/ai.clck.3.gbl.min.js.map +1 -0
- package/browser/{ai.clck.3.js → es5/ai.clck.3.js} +808 -784
- package/browser/es5/ai.clck.3.js.map +1 -0
- package/browser/es5/ai.clck.3.min.js +6 -0
- package/browser/es5/ai.clck.3.min.js.map +1 -0
- package/dist/{applicationinsights-clickanalytics-js.js → es5/applicationinsights-clickanalytics-js.js} +808 -784
- package/dist/es5/applicationinsights-clickanalytics-js.js.map +1 -0
- package/dist/es5/applicationinsights-clickanalytics-js.min.js +6 -0
- package/dist/es5/applicationinsights-clickanalytics-js.min.js.map +1 -0
- package/{dist-esm → dist-es5}/Behaviours.js +1 -1
- package/{dist-esm → dist-es5}/ClickAnalyticsPlugin.js +2 -2
- package/{dist-esm → dist-es5}/ClickAnalyticsPlugin.js.map +1 -1
- package/{dist-esm → dist-es5}/DataCollector.js +1 -1
- package/{dist-esm → dist-es5}/Enums.js +1 -1
- package/{dist-esm → dist-es5}/Interfaces/Datamodel.js +1 -1
- package/{dist-esm → dist-es5}/__DynamicConstants.js +1 -1
- package/{dist-esm → dist-es5}/applicationinsights-clickanalytics-js.js +1 -1
- package/{dist-esm → dist-es5}/common/Utils.js +1 -1
- package/{dist-esm → dist-es5}/events/PageAction.js +1 -1
- package/{dist-esm → dist-es5}/events/WebEvent.js +1 -1
- package/{dist-esm → dist-es5}/handlers/AutoCaptureHandler.js +1 -1
- package/{dist-esm → dist-es5}/handlers/DomContentHandler.js +3 -2
- package/dist-es5/handlers/DomContentHandler.js.map +1 -0
- package/package.json +19 -18
- package/tsconfig.json +4 -3
- package/types/applicationinsights-clickanalytics-js.d.ts +101 -2
- package/{dist/applicationinsights-clickanalytics-js.d.ts → types/applicationinsights-clickanalytics-js.namespaced.d.ts} +1 -1
- package/browser/ai.clck.3.0.0-beta.2303-11.cjs.js.map +0 -1
- package/browser/ai.clck.3.0.0-beta.2303-11.cjs.min.js +0 -6
- package/browser/ai.clck.3.0.0-beta.2303-11.cjs.min.js.map +0 -1
- package/browser/ai.clck.3.0.0-beta.2303-11.gbl.js.map +0 -1
- package/browser/ai.clck.3.0.0-beta.2303-11.gbl.min.js +0 -6
- package/browser/ai.clck.3.0.0-beta.2303-11.gbl.min.js.map +0 -1
- package/browser/ai.clck.3.0.0-beta.2303-11.integrity.json +0 -66
- package/browser/ai.clck.3.0.0-beta.2303-11.js.map +0 -1
- package/browser/ai.clck.3.0.0-beta.2303-11.min.js +0 -6
- package/browser/ai.clck.3.0.0-beta.2303-11.min.js.map +0 -1
- package/browser/ai.clck.3.cjs.js.map +0 -1
- package/browser/ai.clck.3.cjs.min.js +0 -6
- package/browser/ai.clck.3.cjs.min.js.map +0 -1
- package/browser/ai.clck.3.gbl.js.map +0 -1
- package/browser/ai.clck.3.gbl.min.js +0 -6
- package/browser/ai.clck.3.gbl.min.js.map +0 -1
- package/browser/ai.clck.3.js.map +0 -1
- package/browser/ai.clck.3.min.js +0 -6
- package/browser/ai.clck.3.min.js.map +0 -1
- package/dist/applicationinsights-clickanalytics-js.api.json +0 -695
- package/dist/applicationinsights-clickanalytics-js.api.md +0 -46
- package/dist/applicationinsights-clickanalytics-js.js.map +0 -1
- package/dist/applicationinsights-clickanalytics-js.min.js +0 -6
- package/dist/applicationinsights-clickanalytics-js.min.js.map +0 -1
- package/dist/applicationinsights-clickanalytics-js.rollup.d.ts +0 -102
- package/dist-esm/handlers/DomContentHandler.js.map +0 -1
- package/src/Behaviours.ts +0 -165
- package/src/ClickAnalyticsPlugin.ts +0 -183
- package/src/DataCollector.ts +0 -159
- package/src/Enums.ts +0 -15
- package/src/Interfaces/Datamodel.ts +0 -300
- package/src/__DynamicConstants.ts +0 -61
- package/src/applicationinsights-clickanalytics-js.ts +0 -6
- package/src/common/Utils.ts +0 -281
- package/src/events/PageAction.ts +0 -197
- package/src/events/WebEvent.ts +0 -202
- package/src/handlers/AutoCaptureHandler.ts +0 -121
- package/src/handlers/DomContentHandler.ts +0 -395
- package/types/Behaviours.d.ts +0 -99
- package/types/ClickAnalyticsPlugin.d.ts +0 -22
- package/types/DataCollector.d.ts +0 -39
- package/types/Enums.d.ts +0 -14
- package/types/Interfaces/Datamodel.d.ts +0 -291
- package/types/__DynamicConstants.d.ts +0 -49
- package/types/common/Utils.d.ts +0 -123
- package/types/events/PageAction.d.ts +0 -28
- package/types/events/WebEvent.d.ts +0 -54
- package/types/handlers/AutoCaptureHandler.d.ts +0 -20
- package/types/handlers/DomContentHandler.d.ts +0 -29
- package/types/tsdoc-metadata.json +0 -11
- /package/{dist-esm → dist-es5}/Behaviours.js.map +0 -0
- /package/{dist-esm → dist-es5}/DataCollector.js.map +0 -0
- /package/{dist-esm → dist-es5}/Enums.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Datamodel.js.map +0 -0
- /package/{dist-esm → dist-es5}/__DynamicConstants.js.map +0 -0
- /package/{dist-esm → dist-es5}/applicationinsights-clickanalytics-js.js.map +0 -0
- /package/{dist-esm → dist-es5}/common/Utils.js.map +0 -0
- /package/{dist-esm → dist-es5}/events/PageAction.js.map +0 -0
- /package/{dist-esm → dist-es5}/events/WebEvent.js.map +0 -0
- /package/{dist-esm → dist-es5}/handlers/AutoCaptureHandler.js.map +0 -0
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Microsoft.ApplicationInsights, 3.0.0-beta.2303-11
|
|
3
|
-
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* Microsoft Application Insights Team
|
|
6
|
-
* https://github.com/microsoft/ApplicationInsights-JS#readme
|
|
7
|
-
*
|
|
8
|
-
* ---------------------------------------------------------------------------
|
|
9
|
-
* This is a single combined (rollup) declaration file for the package,
|
|
10
|
-
* use this version if your build environment doesn't support the using the
|
|
11
|
-
* individual *.d.ts files or default namespace wrapped version.
|
|
12
|
-
* - Namespaced version: applicationinsights-clickanalytics-js.d.ts
|
|
13
|
-
* ---------------------------------------------------------------------------
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { BaseTelemetryPlugin } from '@microsoft/applicationinsights-core-js';
|
|
17
|
-
import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
|
|
18
|
-
import { IConfig } from '@microsoft/applicationinsights-common';
|
|
19
|
-
import { IConfiguration } from '@microsoft/applicationinsights-core-js';
|
|
20
|
-
import { ICustomProperties } from '@microsoft/applicationinsights-core-js';
|
|
21
|
-
import { IEventTelemetry } from '@microsoft/applicationinsights-common';
|
|
22
|
-
import { IPlugin } from '@microsoft/applicationinsights-core-js';
|
|
23
|
-
import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
|
|
24
|
-
import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
|
|
25
|
-
import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
|
|
26
|
-
|
|
27
|
-
export declare function BehaviorEnumValidator(enumObj: any): (key: string) => any;
|
|
28
|
-
|
|
29
|
-
export declare function BehaviorMapValidator(map: any): (key: string) => any;
|
|
30
|
-
|
|
31
|
-
export declare function BehaviorValueValidator(behaviorArray: string[]): (key: string) => string;
|
|
32
|
-
|
|
33
|
-
export declare class ClickAnalyticsPlugin extends BaseTelemetryPlugin {
|
|
34
|
-
identifier: string;
|
|
35
|
-
priority: number;
|
|
36
|
-
static Version: string;
|
|
37
|
-
constructor();
|
|
38
|
-
initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
39
|
-
processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
40
|
-
/**
|
|
41
|
-
* Logs a page action event.
|
|
42
|
-
* @param IPageActionTelemetry
|
|
43
|
-
* @param customProperties - Additional data used to filter events and metrics. Defaults to empty.
|
|
44
|
-
*/
|
|
45
|
-
trackPageAction(pageAction?: IPageActionTelemetry, customProperties?: ICustomProperties): void;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Page Action event
|
|
50
|
-
*/
|
|
51
|
-
declare interface IPageActionTelemetry extends IEventTelemetry {
|
|
52
|
-
/**
|
|
53
|
-
* Target uri for PageAction events
|
|
54
|
-
*/
|
|
55
|
-
targetUri?: string;
|
|
56
|
-
/**
|
|
57
|
-
* One of the awa.actionType values
|
|
58
|
-
*/
|
|
59
|
-
actionType?: string;
|
|
60
|
-
/**
|
|
61
|
-
* One of the awa.behavior values.
|
|
62
|
-
*/
|
|
63
|
-
behavior?: string | number;
|
|
64
|
-
/**
|
|
65
|
-
* X, Y representing the absolute co-ordinates withrespect to topleft corner of the page. This should be normalized for the screen resolution to provide better heat map.
|
|
66
|
-
*/
|
|
67
|
-
clickCoordinates?: string;
|
|
68
|
-
/**
|
|
69
|
-
* JSON-formatted array of content acted upon
|
|
70
|
-
*/
|
|
71
|
-
content?: any;
|
|
72
|
-
/**
|
|
73
|
-
* Version indicating content version which aids in parsing the content.
|
|
74
|
-
*/
|
|
75
|
-
contentVer?: string;
|
|
76
|
-
/**
|
|
77
|
-
* Uri of the referrer, this is a convinence for adaptors to just leverage PageAction for click analytics without linking it to the respective Page Views.
|
|
78
|
-
*/
|
|
79
|
-
refUri?: string;
|
|
80
|
-
/**
|
|
81
|
-
* Time taken in milliseconds since the user saw the page and took the action (such as click on a link, etc.). This will be in seconds.
|
|
82
|
-
*/
|
|
83
|
-
timeToAction?: number;
|
|
84
|
-
/**
|
|
85
|
-
* A relative or absolute URL that identifies the page or other item. Defaults to the window location.
|
|
86
|
-
*/
|
|
87
|
-
uri?: string;
|
|
88
|
-
/**
|
|
89
|
-
* Page type
|
|
90
|
-
*/
|
|
91
|
-
pageType?: string;
|
|
92
|
-
/**
|
|
93
|
-
* Title of the page
|
|
94
|
-
*/
|
|
95
|
-
pageName?: string;
|
|
96
|
-
/**
|
|
97
|
-
* Content Id (Parent Id) of the parent in which the content was located;
|
|
98
|
-
*/
|
|
99
|
-
parentId?: string;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export { }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DomContentHandler.js.map","sources":["DomContentHandler.js"],"sourcesContent":["/**\r\n* @copyright Microsoft 2020\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _throwInternal, getDocument, hasDocument, isNullOrUndefined, objExtend } from \"@microsoft/applicationinsights-core-js\";\r\nimport { _DYN_ATTRIBUTES, _DYN_CAPTURE_ALL_META_DAT2, _DYN_CONTENT, _DYN_CONTENT_NAME, _DYN_CUSTOM_DATA_PREFIX, _DYN_DATA_TAGS, _DYN_GET_ATTRIBUTE, _DYN_GET_ELEMENT_CONTENT, _DYN_INDEX_OF, _DYN_LENGTH, _DYN_META_DATA_PREFIX, _DYN_NAME, _DYN_PARENT_DATA_TAG, _DYN_PARENT_ELEMENT, _DYN_PARENT_NODE, _DYN_TAG_NAME, _DYN_USE_DEFAULT_CONTENT_1, _DYN__CONFIG, _DYN__TRACE_LOGGER } from \"../__DynamicConstants\";\r\nimport { isValueAssigned, removeInvalidElements, walkUpDomChainWithElementValidation } from \"../common/Utils\";\r\nvar MAX_CONTENTNAME_LENGTH = 200;\r\nvar DomContentHandler = /** @class */ (function () {\r\n /**\r\n * @param config - ClickAnalytics configuration object\r\n * @param traceLogger - Trace logger to log to console.\r\n */\r\n function DomContentHandler(_config, _traceLogger) {\r\n this._config = _config;\r\n this._traceLogger = _traceLogger;\r\n dynamicProto(DomContentHandler, this, function (_self) {\r\n _self.getMetadata = function () {\r\n var dataTags = (_self[_DYN__CONFIG /* @min:%2e_config */] || {})[_DYN_DATA_TAGS /* @min:%2edataTags */];\r\n var metaTags = {};\r\n if (hasDocument) {\r\n metaTags = isValueAssigned(dataTags.metaDataPrefix) ? _getMetaDataFromDOM(dataTags[_DYN_CAPTURE_ALL_META_DAT2 /* @min:%2ecaptureAllMetaDataContent */], dataTags[_DYN_META_DATA_PREFIX /* @min:%2emetaDataPrefix */], false) :\r\n _getMetaDataFromDOM(dataTags[_DYN_CAPTURE_ALL_META_DAT2 /* @min:%2ecaptureAllMetaDataContent */], \"\", false);\r\n }\r\n return metaTags;\r\n };\r\n _self[_DYN_GET_ELEMENT_CONTENT /* @min:%2egetElementContent */] = function (element) {\r\n if (!element) {\r\n return {};\r\n }\r\n var dataTags = (_self[_DYN__CONFIG /* @min:%2e_config */] || {})[_DYN_DATA_TAGS /* @min:%2edataTags */];\r\n var elementContent = {};\r\n var biBlobValue;\r\n var parentDataTagPrefix;\r\n var dataTagPrefix = dataTags[_DYN_CUSTOM_DATA_PREFIX /* @min:%2ecustomDataPrefix */];\r\n var aiBlobAttributeTag = dataTagPrefix + dataTags.aiBlobAttributeTag;\r\n if (isValueAssigned(dataTags[_DYN_PARENT_DATA_TAG /* @min:%2eparentDataTag */])) {\r\n parentDataTagPrefix = dataTagPrefix + dataTags[_DYN_PARENT_DATA_TAG /* @min:%2eparentDataTag */];\r\n }\r\n if (!_isTracked(element, dataTagPrefix, aiBlobAttributeTag)) {\r\n // capture blob from element or hierarchy\r\n biBlobValue = element[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](aiBlobAttributeTag);\r\n if (biBlobValue) {\r\n try {\r\n elementContent = JSON.parse(biBlobValue);\r\n }\r\n catch (e) {\r\n _throwInternal(_self[_DYN__TRACE_LOGGER /* @min:%2e_traceLogger */], 1 /* eLoggingSeverity.CRITICAL */, 101 /* _eInternalMessageId.CannotParseAiBlobValue */, \"Can not parse \" + biBlobValue);\r\n }\r\n }\r\n else {\r\n // traverse up the DOM to find the closest parent with data-* tag defined\r\n //contentElement = walkUpDomChainWithElementValidation(element, _self._isTracked, dataTagPrefix);\r\n elementContent = objExtend(elementContent, _populateElementContent(element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag));\r\n }\r\n }\r\n else {\r\n elementContent = objExtend(elementContent, _populateElementContentwithDataTag(element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag));\r\n }\r\n removeInvalidElements(elementContent);\r\n if (parentDataTagPrefix) {\r\n elementContent = objExtend(elementContent, _getParentDetails(element, elementContent, dataTagPrefix, aiBlobAttributeTag));\r\n }\r\n return elementContent;\r\n };\r\n /**\r\n * Capture current level Element content\r\n */\r\n function _captureElementContentWithDataTag(contentElement, elementContent, dataTagPrefix) {\r\n for (var i = 0, attrib; i < contentElement.attributes[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n attrib = contentElement[_DYN_ATTRIBUTES /* @min:%2eattributes */][i];\r\n if (attrib.name[_DYN_INDEX_OF /* @min:%2eindexOf */](dataTagPrefix) !== 0) {\r\n continue;\r\n }\r\n var attribName = attrib[_DYN_NAME /* @min:%2ename */].replace(dataTagPrefix, \"\");\r\n elementContent[attribName] = attrib.value;\r\n }\r\n }\r\n /**\r\n * Walk Up the DOM to capture Element content\r\n */\r\n function _walkUpDomChainCaptureData(el, elementContent, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag) {\r\n var element = el;\r\n var parentDataTagFound = false;\r\n var elementLevelFlag = false; // Use this flag to capture 'id' only at the incoming html element level.\r\n while (!isNullOrUndefined(element) && !isNullOrUndefined(element[_DYN_ATTRIBUTES /* @min:%2eattributes */])) {\r\n var attributes = element[_DYN_ATTRIBUTES /* @min:%2eattributes */];\r\n for (var i = 0; i < attributes[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n var attrib = attributes[i];\r\n if (attrib.name[_DYN_INDEX_OF /* @min:%2eindexOf */](dataTagPrefix) !== 0) {\r\n continue;\r\n }\r\n if (attrib.name[_DYN_INDEX_OF /* @min:%2eindexOf */](parentDataTagPrefix) === 0) {\r\n parentDataTagFound = true;\r\n }\r\n // Todo handle blob data\r\n if (attrib.name[_DYN_INDEX_OF /* @min:%2eindexOf */](aiBlobAttributeTag) === 0) {\r\n continue;\r\n }\r\n var attribName = attrib[_DYN_NAME /* @min:%2ename */].replace(dataTagPrefix, \"\");\r\n if (elementLevelFlag && attribName === \"id\") {\r\n continue; // skip capturing id if not at the first level.\r\n }\r\n if (!isValueAssigned(elementContent[attribName])) {\r\n elementContent[attribName] = attrib.value;\r\n }\r\n }\r\n // break after current level;\r\n if (parentDataTagFound) {\r\n break;\r\n }\r\n elementLevelFlag = true; // after the initial level set this flag to true.\r\n element = element[_DYN_PARENT_NODE /* @min:%2eparentNode */];\r\n }\r\n }\r\n /**\r\n * Capture Element content along with Data Tag attributes and values\r\n */\r\n function _populateElementContent(element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag) {\r\n var elementContent = {};\r\n if (!element) {\r\n return elementContent;\r\n }\r\n var htmlContent = _getHtmlIdAndContentName(element);\r\n elementContent = {\r\n id: htmlContent.id || \"\",\r\n contentName: htmlContent[_DYN_CONTENT_NAME /* @min:%2econtentName */] || \"\"\r\n };\r\n if (isValueAssigned(parentDataTagPrefix)) {\r\n _walkUpDomChainCaptureData(element, elementContent, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag);\r\n }\r\n // Validate to ensure the minimum required field 'id' or 'contentName' is present.\r\n // The content schema defines id, aN and sN as required fields. However,\r\n // requiring these fields would result in majority of adopter's content from being collected.\r\n // Just throw a warning and continue collection.\r\n if (!elementContent.id && !elementContent[_DYN_CONTENT_NAME /* @min:%2econtentName */]) {\r\n _throwInternal(_traceLogger, 2 /* eLoggingSeverity.WARNING */, 102 /* _eInternalMessageId.InvalidContentBlob */, \"Invalid content blob. Missing required attributes (id, contentName. \" +\r\n \" Content information will still be collected!\");\r\n }\r\n return elementContent;\r\n }\r\n /**\r\n * Capture Element content along with Data Tag attributes and values\r\n */\r\n function _populateElementContentwithDataTag(element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag) {\r\n var dataTags = (_self[_DYN__CONFIG /* @min:%2e_config */] || {})[_DYN_DATA_TAGS /* @min:%2edataTags */];\r\n var elementContent = {};\r\n if (!element) {\r\n return elementContent;\r\n }\r\n var htmlContent = _getHtmlIdAndContentName(element);\r\n if (isValueAssigned(parentDataTagPrefix)) {\r\n _walkUpDomChainCaptureData(element, elementContent, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag);\r\n }\r\n else {\r\n _captureElementContentWithDataTag(element, elementContent, dataTagPrefix);\r\n }\r\n if (dataTags[_DYN_USE_DEFAULT_CONTENT_1 /* @min:%2euseDefaultContentNameOrId */]) {\r\n if (!isValueAssigned(elementContent.id)) {\r\n elementContent.id = htmlContent.id || \"\";\r\n }\r\n elementContent[_DYN_CONTENT_NAME /* @min:%2econtentName */] = htmlContent[_DYN_CONTENT_NAME /* @min:%2econtentName */] || \"\";\r\n }\r\n // Validate to ensure the minimum required field 'id' or 'contentName' is present.\r\n // The content schema defines id, aN and sN as required fields. However,\r\n // requiring these fields would result in majority of adopter's content from being collected.\r\n // Just throw a warning and continue collection.\r\n if (!elementContent.id && !elementContent[_DYN_CONTENT_NAME /* @min:%2econtentName */]) {\r\n _throwInternal(_traceLogger, 2 /* eLoggingSeverity.WARNING */, 102 /* _eInternalMessageId.InvalidContentBlob */, \"Invalid content blob. Missing required attributes (id, contentName. \" +\r\n \" Content information will still be collected!\");\r\n }\r\n return elementContent;\r\n }\r\n /**\r\n * Retrieve a specified metadata tag value from the DOM.\r\n * @param captureAllMetaDataContent - Flag to capture all metadata content\r\n * @param prefix - Prefix to search the metatags with.\r\n * @param removePrefix - Specifies if the prefix must be excluded from key names in the returned collection.\r\n * @returns Metadata collection/property bag\r\n */\r\n function _getMetaDataFromDOM(captureAllMetaDataContent, prefix, removePrefix) {\r\n var metaElements;\r\n var metaData = {};\r\n if (hasDocument) {\r\n metaElements = document.querySelectorAll(\"meta\");\r\n for (var i = 0; i < metaElements[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n var meta = metaElements[i];\r\n if (meta[_DYN_NAME /* @min:%2ename */]) {\r\n if (captureAllMetaDataContent || meta.name[_DYN_INDEX_OF /* @min:%2eindexOf */](prefix) === 0) {\r\n var name_1 = removePrefix ? meta[_DYN_NAME /* @min:%2ename */].replace(prefix, \"\") : meta[_DYN_NAME /* @min:%2ename */];\r\n metaData[name_1] = meta[_DYN_CONTENT /* @min:%2econtent */];\r\n }\r\n }\r\n }\r\n }\r\n return metaData;\r\n }\r\n /**\r\n * Gets the default content name.\r\n * @param element - An html element\r\n * @param useDefaultContentNameOrId - Flag indicating if an element is market PII.\r\n * @returns Content name\r\n */\r\n function _getDefaultContentName(element, useDefaultContentName) {\r\n if (useDefaultContentName === false || !element[_DYN_TAG_NAME /* @min:%2etagName */]) {\r\n return \"\";\r\n }\r\n var doc = getDocument() || {};\r\n var contentName;\r\n switch (element[_DYN_TAG_NAME /* @min:%2etagName */]) {\r\n case \"A\":\r\n contentName = doc.all ? element.innerText || element.innerHTML : element.text || element.innerHTML;\r\n break;\r\n case \"IMG\":\r\n case \"AREA\":\r\n contentName = element.alt;\r\n break;\r\n default:\r\n contentName = element.value || element[_DYN_NAME /* @min:%2ename */] || element.alt || element.innerText || element.id;\r\n }\r\n return contentName.substring(0, MAX_CONTENTNAME_LENGTH);\r\n }\r\n /**\r\n * Check if the user wants to track the element, which means if the element has any tags with data-* or customDataPrefix\r\n * @param element - An html element\r\n * @returns true if any data-* exist, otherwise return false\r\n */\r\n function _isTracked(element, dataTag, aiBlobAttributeTag) {\r\n var attrs = element[_DYN_ATTRIBUTES /* @min:%2eattributes */];\r\n var dataTagFound = false;\r\n for (var i = 0; i < attrs[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n var attributeName = attrs[i][_DYN_NAME /* @min:%2ename */];\r\n if (attributeName === aiBlobAttributeTag) {\r\n // ignore if the attribute name is equal to aiBlobAttributeTag\r\n return false;\r\n }\r\n else if (attributeName[_DYN_INDEX_OF /* @min:%2eindexOf */](dataTag) === 0) {\r\n dataTagFound = true;\r\n }\r\n }\r\n return dataTagFound;\r\n }\r\n function _getHtmlIdAndContentName(element) {\r\n var _a;\r\n var dataTags = (_self[_DYN__CONFIG /* @min:%2e_config */] || {})[_DYN_DATA_TAGS /* @min:%2edataTags */];\r\n var callback = (_self[_DYN__CONFIG /* @min:%2e_config */] || {}).callback;\r\n var htmlContent = {};\r\n if (!element) {\r\n return htmlContent;\r\n }\r\n if (dataTags[_DYN_USE_DEFAULT_CONTENT_1 /* @min:%2euseDefaultContentNameOrId */]) {\r\n var customizedContentName = callback[_DYN_CONTENT_NAME /* @min:%2econtentName */] ? callback[_DYN_CONTENT_NAME /* @min:%2econtentName */](element, dataTags[_DYN_USE_DEFAULT_CONTENT_1 /* @min:%2euseDefaultContentNameOrId */]) : \"\";\r\n var defaultContentName = _getDefaultContentName(element, dataTags[_DYN_USE_DEFAULT_CONTENT_1 /* @min:%2euseDefaultContentNameOrId */]);\r\n htmlContent = (_a = {\r\n id: element.id\r\n },\r\n _a[_DYN_CONTENT_NAME /* @min:contentName */] = customizedContentName || defaultContentName || element[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](\"alt\"),\r\n _a);\r\n }\r\n return htmlContent;\r\n }\r\n /**\r\n * Computes the parentId of a given element.\r\n * @param element - An html element\r\n * @returns An object containing the closest parentId , can be empty if nothing was found\r\n */\r\n function _getParentDetails(element, elementContent, dataTagPrefix, aiBlobAttributeTag) {\r\n var parentId = elementContent[\"parentid\"];\r\n var parentName = elementContent[\"parentname\"];\r\n var parentInfo = {};\r\n if (parentId || parentName || !element) {\r\n return parentInfo;\r\n }\r\n return _populateParentInfo(element, dataTagPrefix, aiBlobAttributeTag);\r\n }\r\n /**\r\n * Check if parent info already set up, if so take and put into content, if not walk up the DOM to find correct info\r\n * @param element - An html element that the user wants to track\r\n * @returns An object containing the parent info, can be empty if nothing was found\r\n */\r\n function _populateParentInfo(element, dataTagPrefix, aiBlobAttributeTag) {\r\n var parentInfo = {};\r\n var parentId;\r\n // if the user does not set up parent info, walk to the DOM, find the closest parent element (with tags) and populate the info\r\n var closestParentElement = walkUpDomChainWithElementValidation(element[_DYN_PARENT_ELEMENT /* @min:%2eparentElement */], _isTracked, dataTagPrefix);\r\n if (closestParentElement) {\r\n var dataAttr = closestParentElement[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](aiBlobAttributeTag) || element[aiBlobAttributeTag];\r\n if (dataAttr) {\r\n try {\r\n var telemetryObject = JSON.parse(dataAttr);\r\n }\r\n catch (e) {\r\n _throwInternal(_traceLogger, 1 /* eLoggingSeverity.CRITICAL */, 101 /* _eInternalMessageId.CannotParseAiBlobValue */, \"Can not parse \" + dataAttr);\r\n }\r\n if (telemetryObject) {\r\n parentId = telemetryObject.id;\r\n }\r\n }\r\n else {\r\n parentId = closestParentElement[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](dataTagPrefix + \"id\");\r\n }\r\n }\r\n if (parentId) {\r\n parentInfo[\"parentid\"] = parentId;\r\n }\r\n else {\r\n var htmlContent = _getHtmlIdAndContentName(element[_DYN_PARENT_ELEMENT /* @min:%2eparentElement */]);\r\n parentInfo[\"parentid\"] = htmlContent.id;\r\n parentInfo[\"parentname\"] = htmlContent[_DYN_CONTENT_NAME /* @min:%2econtentName */];\r\n }\r\n return parentInfo;\r\n }\r\n });\r\n }\r\n /**\r\n * Collect metatags from DOM.\r\n * Collect data from meta tags.\r\n * @returns {object} - Metatags collection/property bag\r\n */\r\n DomContentHandler.prototype.getMetadata = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Collect data-* attributes for the given element.\r\n * All attributes with data-* prefix or user provided customDataPrefix are collected.'data-*' prefix is removed from the key name.\r\n * @param element - The element from which attributes need to be collected.\r\n * @returns String representation of the Json array of element attributes\r\n */\r\n DomContentHandler.prototype.getElementContent = function (element) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return DomContentHandler;\r\n}());\r\nexport { DomContentHandler };\r\n//# sourceMappingURL=DomContentHandler.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;kEAkBM,CAAC;;;;;6BACsB;AAC7B;AACA;AACA"}
|
package/src/Behaviours.ts
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Microsoft 2020
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// Behavior enum values
|
|
6
|
-
export enum Behavior {
|
|
7
|
-
UNDEFINED = 0, // default, Undefined
|
|
8
|
-
|
|
9
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
10
|
-
// Page Experience [1-19]
|
|
11
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
12
|
-
NAVIGATIONBACK = 1, // Advancing to the previous index position within a webpage
|
|
13
|
-
NAVIGATION = 2, // Advancing to a specific index position within a webpage
|
|
14
|
-
NAVIGATIONFORWARD = 3, // Advancing to the next index position within a webpage
|
|
15
|
-
APPLY = 4, // Applying filter(s) or making selections
|
|
16
|
-
REMOVE = 5, // Applying filter(s) or removing selections
|
|
17
|
-
SORT = 6, // Sorting content
|
|
18
|
-
EXPAND = 7, // Expanding content or content container
|
|
19
|
-
REDUCE = 8, // Sorting content
|
|
20
|
-
CONTEXTMENU = 9, // Context Menu
|
|
21
|
-
TAB = 10, // Tab control
|
|
22
|
-
COPY = 11, // Copy the contents of a page
|
|
23
|
-
EXPERIMENTATION = 12, // Used to identify a third party experimentation event
|
|
24
|
-
PRINT = 13, // User printed page
|
|
25
|
-
SHOW = 14, // Displaying an overlay
|
|
26
|
-
HIDE = 15, // Hiding an overlay
|
|
27
|
-
MAXIMIZE = 16, // Maximizing an overlay
|
|
28
|
-
MINIMIZE = 17, // Minimizing an overlay
|
|
29
|
-
BACKBUTTON = 18, // Clicking the back button
|
|
30
|
-
|
|
31
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
32
|
-
// Scenario Process [20-39]
|
|
33
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
34
|
-
STARTPROCESS = 20, // Initiate a web process unique to adopter
|
|
35
|
-
PROCESSCHECKPOINT = 21, // Represents a checkpoint in a web process unique to adopter
|
|
36
|
-
COMPLETEPROCESS = 22, // Page Actions that complete a web process unique to adopter
|
|
37
|
-
SCENARIOCANCEL = 23, // Actions resulting from cancelling a process/scenario
|
|
38
|
-
|
|
39
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
40
|
-
// Download [40-59]
|
|
41
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
42
|
-
DOWNLOADCOMMIT = 40, // Initiating an unmeasurable off-network download
|
|
43
|
-
DOWNLOAD = 41, // Initiating a download
|
|
44
|
-
|
|
45
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
46
|
-
// Search [60-79]
|
|
47
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
48
|
-
SEARCHAUTOCOMPLETE = 60, // Auto-completing a search query during user input
|
|
49
|
-
SEARCH = 61, // Submitting a search query
|
|
50
|
-
SEARCHINITIATE = 62, // Initiating a search query
|
|
51
|
-
TEXTBOXINPUT = 63, // Typing or entering text in the text box
|
|
52
|
-
|
|
53
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
54
|
-
// Commerce [80-99]
|
|
55
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
56
|
-
VIEWCART = 82, // Viewing the cart
|
|
57
|
-
ADDWISHLIST = 83, // Adding a physical or digital good or services to a wishlist
|
|
58
|
-
FINDSTORE = 84, // Finding a physical store
|
|
59
|
-
CHECKOUT = 85, // Before you fill in credit card info
|
|
60
|
-
REMOVEFROMCART = 86, // Remove an item from the cart
|
|
61
|
-
PURCHASECOMPLETE = 87, // Used to track the pageView event that happens when the CongratsPage or Thank You page loads after a successful purchase
|
|
62
|
-
VIEWCHECKOUTPAGE = 88, // View the checkout page
|
|
63
|
-
VIEWCARTPAGE = 89, // View the cart page
|
|
64
|
-
VIEWPDP = 90, // View a PDP
|
|
65
|
-
UPDATEITEMQUANTITY = 91, // Update an item's quantity
|
|
66
|
-
INTENTTOBUY = 92, // User has the intent to buy an item
|
|
67
|
-
PUSHTOINSTALL = 93, // User has selected the push to install option
|
|
68
|
-
|
|
69
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
70
|
-
// Authentication [100-119]
|
|
71
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
72
|
-
SIGNIN = 100, // User sign-in
|
|
73
|
-
SIGNOUT = 101, // User sign-out
|
|
74
|
-
|
|
75
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
76
|
-
// Social [120-139]
|
|
77
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
78
|
-
SOCIALSHARE = 120, // "Sharing" content for a specific social channel
|
|
79
|
-
SOCIALLIKE = 121, // "Liking" content for a specific social channel
|
|
80
|
-
SOCIALREPLY = 122, // "Replying" content for a specific social channel
|
|
81
|
-
CALL = 123, // Click on a "call" link
|
|
82
|
-
EMAIL = 124, // Click on an "email" link
|
|
83
|
-
COMMUNITY = 125, // Click on a "community" link
|
|
84
|
-
|
|
85
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
86
|
-
// Feedback [140-159]
|
|
87
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
88
|
-
VOTE = 140, // Rating content or voting for content
|
|
89
|
-
SURVEYCHECKPOINT = 145, // reaching the survey page/form
|
|
90
|
-
|
|
91
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
92
|
-
// Registration, Contact [160-179]
|
|
93
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
94
|
-
REGISTRATIONINITIATE = 161, // Initiating a registration process
|
|
95
|
-
REGISTRATIONCOMPLETE = 162, // Completing a registration process
|
|
96
|
-
CANCELSUBSCRIPTION = 163, // Canceling a subscription
|
|
97
|
-
RENEWSUBSCRIPTION = 164, // Renewing a subscription
|
|
98
|
-
CHANGESUBSCRIPTION = 165, // Changing a subscription
|
|
99
|
-
REGISTRATIONCHECKPOINT = 166, // Reaching the registration page/form
|
|
100
|
-
|
|
101
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
102
|
-
// Chat [180-199]
|
|
103
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
104
|
-
CHATINITIATE = 180, // Initiating a chat experience
|
|
105
|
-
CHATEND = 181, // Ending a chat experience
|
|
106
|
-
|
|
107
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
108
|
-
// Trial [200-209]
|
|
109
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
110
|
-
TRIALSIGNUP = 200, // Signing-up for a trial
|
|
111
|
-
TRIALINITIATE = 201, // Initiating a trial
|
|
112
|
-
|
|
113
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
114
|
-
// Signup [210-219]
|
|
115
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
116
|
-
SIGNUP = 210, // Signing-up for a notification or service
|
|
117
|
-
FREESIGNUP = 211, // Signing-up for a free service
|
|
118
|
-
|
|
119
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
120
|
-
// Referals [220-229]
|
|
121
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
122
|
-
PARTNERREFERRAL = 220, // Navigating to a partner's web property
|
|
123
|
-
|
|
124
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
125
|
-
// Intents [230-239]
|
|
126
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
127
|
-
LEARNLOWFUNNEL = 230, // Engaging in learning behavior on a commerce page (ex. "Learn more click")
|
|
128
|
-
LEARNHIGHFUNNEL = 231, // Engaging in learning behavior on a non-commerce page (ex. "Learn more click")
|
|
129
|
-
SHOPPINGINTENT = 232, // Shopping behavior prior to landing on a commerce page
|
|
130
|
-
|
|
131
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
132
|
-
// Video [240-259]
|
|
133
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
134
|
-
VIDEOSTART = 240, // Initiating a video
|
|
135
|
-
VIDEOPAUSE = 241, // Pausing a video
|
|
136
|
-
VIDEOCONTINUE = 242, // Pausing or resuming a video.
|
|
137
|
-
VIDEOCHECKPOINT = 243, // Capturing predetermined video percentage complete.
|
|
138
|
-
VIDEOJUMP = 244, // Jumping to a new video location.
|
|
139
|
-
VIDEOCOMPLETE = 245, // Completing a video (or % proxy)
|
|
140
|
-
VIDEOBUFFERING = 246, // Capturing a video buffer event
|
|
141
|
-
VIDEOERROR = 247, // Capturing a video error
|
|
142
|
-
VIDEOMUTE = 248, // Muting a video
|
|
143
|
-
VIDEOUNMUTE = 249, // Unmuting a video
|
|
144
|
-
VIDEOFULLSCREEN = 250, // Making a video full screen
|
|
145
|
-
VIDEOUNFULLSCREEN = 251, // Making a video return from full screen to original size
|
|
146
|
-
VIDEOREPLAY = 252, // Making a video replay
|
|
147
|
-
VIDEOPLAYERLOAD = 253, // Loading the video player
|
|
148
|
-
VIDEOPLAYERCLICK = 254, // Click on a button within the interactive player
|
|
149
|
-
VIDEOVOLUMECONTROL = 255, // Click on video volume control
|
|
150
|
-
VIDEOAUDIOTRACKCONTROL = 256, // Click on audio control within a video
|
|
151
|
-
VIDEOCLOSEDCAPTIONCONTROL = 257, // Click on the closed caption control
|
|
152
|
-
VIDEOCLOSEDCAPTIONSTYLE = 258, // Click to change closed caption style
|
|
153
|
-
VIDEORESOLUTIONCONTROL = 259, // Click to change resolution
|
|
154
|
-
|
|
155
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
156
|
-
// Advertisement Engagement [280-299]
|
|
157
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
158
|
-
ADBUFFERING = 283, // Ad is buffering
|
|
159
|
-
ADERROR = 284, // Ad error
|
|
160
|
-
ADSTART = 285, // Ad start
|
|
161
|
-
ADCOMPLETE = 286, // Ad complete
|
|
162
|
-
ADSKIP = 287, // Ad skipped
|
|
163
|
-
ADTIMEOUT = 288, // Ad timed-out
|
|
164
|
-
OTHER = 300 // Other
|
|
165
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Microsoft 2020
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
6
|
-
import { IConfig, IPropertiesPlugin, PropertiesPluginIdentifier } from "@microsoft/applicationinsights-common";
|
|
7
|
-
import {
|
|
8
|
-
BaseTelemetryPlugin, IAppInsightsCore, IConfigDefaults, IConfiguration, ICustomProperties, IPlugin, IProcessTelemetryContext,
|
|
9
|
-
IProcessTelemetryUnloadContext, ITelemetryItem, ITelemetryPluginChain, ITelemetryUnloadState, _eInternalMessageId, _throwInternal,
|
|
10
|
-
arrForEach, cfgDfFunc, cfgDfMerge, cfgDfString, cfgDfValidate, createProcessTelemetryContext, dumpObj, eLoggingSeverity,
|
|
11
|
-
getExceptionName, isNullOrUndefined, onConfigChange, throwError, unloadComponents
|
|
12
|
-
} from "@microsoft/applicationinsights-core-js";
|
|
13
|
-
import { PropertiesPlugin } from "@microsoft/applicationinsights-properties-js";
|
|
14
|
-
import { hasDocument, objDeepFreeze } from "@nevware21/ts-utils";
|
|
15
|
-
import {
|
|
16
|
-
IAutoCaptureHandler, IClickAnalyticsConfiguration, IContentHandler, ICoreData, ICustomDataTags, IPageActionTelemetry, IValueCallback
|
|
17
|
-
} from "./Interfaces/Datamodel";
|
|
18
|
-
import {
|
|
19
|
-
BehaviorEnumValidator, BehaviorMapValidator, BehaviorValueValidator, DEFAULT_AI_BLOB_ATTRIBUTE_TAG, DEFAULT_DATA_PREFIX,
|
|
20
|
-
DEFAULT_DONOT_TRACK_TAG
|
|
21
|
-
} from "./common/Utils";
|
|
22
|
-
import { PageAction } from "./events/PageAction";
|
|
23
|
-
import { AutoCaptureHandler } from "./handlers/AutoCaptureHandler";
|
|
24
|
-
import { DomContentHandler } from "./handlers/DomContentHandler";
|
|
25
|
-
|
|
26
|
-
export { BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator }
|
|
27
|
-
|
|
28
|
-
const defaultValues: IConfigDefaults<IClickAnalyticsConfiguration> = objDeepFreeze({
|
|
29
|
-
autoCapture: true,
|
|
30
|
-
callback: cfgDfMerge<IValueCallback, IClickAnalyticsConfiguration>({
|
|
31
|
-
pageActionPageTags: cfgDfFunc(),
|
|
32
|
-
pageName: cfgDfFunc(),
|
|
33
|
-
contentName: cfgDfFunc()
|
|
34
|
-
}),
|
|
35
|
-
pageTags: {},
|
|
36
|
-
coreData: cfgDfMerge<ICoreData, IClickAnalyticsConfiguration>({
|
|
37
|
-
referrerUri: hasDocument ? document.referrer : "",
|
|
38
|
-
requestUri: cfgDfString(),
|
|
39
|
-
pageName: cfgDfString(),
|
|
40
|
-
pageType: cfgDfString()
|
|
41
|
-
}),
|
|
42
|
-
dataTags: cfgDfMerge<ICustomDataTags, IClickAnalyticsConfiguration>({
|
|
43
|
-
useDefaultContentNameOrId: false,
|
|
44
|
-
aiBlobAttributeTag: DEFAULT_AI_BLOB_ATTRIBUTE_TAG,
|
|
45
|
-
customDataPrefix: cfgDfValidate(_dataPrefixChk, DEFAULT_DATA_PREFIX),
|
|
46
|
-
captureAllMetaDataContent: false,
|
|
47
|
-
dntDataTag: DEFAULT_DONOT_TRACK_TAG,
|
|
48
|
-
metaDataPrefix: cfgDfString(),
|
|
49
|
-
parentDataTag: cfgDfString()
|
|
50
|
-
}),
|
|
51
|
-
behaviorValidator: cfgDfFunc((key:string) => key || ""),
|
|
52
|
-
defaultRightClickBhvr: cfgDfString(),
|
|
53
|
-
dropInvalidEvents : false,
|
|
54
|
-
urlCollectHash: false,
|
|
55
|
-
urlCollectQuery: false
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
function _dataPrefixChk(val: any) {
|
|
59
|
-
return val && val.indexOf(DEFAULT_DATA_PREFIX) === 0;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export class ClickAnalyticsPlugin extends BaseTelemetryPlugin {
|
|
63
|
-
public identifier: string = "ClickAnalyticsPlugin";
|
|
64
|
-
public priority: number = 181;
|
|
65
|
-
public static Version = "#version#";
|
|
66
|
-
|
|
67
|
-
constructor() {
|
|
68
|
-
super();
|
|
69
|
-
|
|
70
|
-
let _config: IClickAnalyticsConfiguration;
|
|
71
|
-
let _pageAction: PageAction;
|
|
72
|
-
let _autoCaptureHandler: IAutoCaptureHandler;
|
|
73
|
-
let _contentHandler: IContentHandler;
|
|
74
|
-
let _autoCapture: boolean;
|
|
75
|
-
|
|
76
|
-
dynamicProto(ClickAnalyticsPlugin, this, (_self, _base) => {
|
|
77
|
-
let _identifier = _self.identifier;
|
|
78
|
-
_initDefaults();
|
|
79
|
-
|
|
80
|
-
_self.initialize = (config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain) => {
|
|
81
|
-
|
|
82
|
-
if (isNullOrUndefined(core)) {
|
|
83
|
-
throwError("Error initializing");
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
super.initialize(config, core, extensions, pluginChain);
|
|
87
|
-
_populateDefaults(config);
|
|
88
|
-
|
|
89
|
-
// Find the properties plugin.
|
|
90
|
-
let _propertiesExtension:IPropertiesPlugin;
|
|
91
|
-
arrForEach(extensions, extension => {
|
|
92
|
-
if (extension.identifier === PropertiesPluginIdentifier) {
|
|
93
|
-
_propertiesExtension = extension as PropertiesPlugin;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
// Append Click Analytics Plugin Version to SDK version.
|
|
97
|
-
if (_propertiesExtension && _propertiesExtension.context &&
|
|
98
|
-
_propertiesExtension.context.internal && _propertiesExtension.context.internal.sdkVersion) {
|
|
99
|
-
_propertiesExtension.context.internal.sdkVersion += "_ClickPlugin"+ ClickAnalyticsPlugin.Version;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
_self.processTelemetry = (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void => {
|
|
104
|
-
_self.processNext(env, itemCtx);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
_self.trackPageAction = (pageAction?: IPageActionTelemetry, customProperties?: ICustomProperties) => {
|
|
108
|
-
try {
|
|
109
|
-
_pageAction.trackPageAction(pageAction, customProperties);
|
|
110
|
-
} catch (e) {
|
|
111
|
-
_throwInternal(
|
|
112
|
-
_self.diagLog(),
|
|
113
|
-
eLoggingSeverity.CRITICAL,
|
|
114
|
-
_eInternalMessageId.TrackPageActionEventFailed,
|
|
115
|
-
"trackPageAction failed, page action event will not be collected: " + getExceptionName(e),
|
|
116
|
-
{ exception: dumpObj(e) });
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
_self._doTeardown = (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean => {
|
|
121
|
-
return unloadComponents([
|
|
122
|
-
_autoCaptureHandler,
|
|
123
|
-
_contentHandler,
|
|
124
|
-
_pageAction
|
|
125
|
-
], unloadCtx, unloadState, () => {
|
|
126
|
-
_initDefaults();
|
|
127
|
-
asyncCallback && asyncCallback();
|
|
128
|
-
})
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
function _populateDefaults(config: IConfiguration) {
|
|
132
|
-
let core = _self.core;
|
|
133
|
-
|
|
134
|
-
_self._addHook(onConfigChange(config, (details) => {
|
|
135
|
-
let config = details.cfg;
|
|
136
|
-
let ctx = createProcessTelemetryContext(null, config, core);
|
|
137
|
-
let _config = ctx.getExtCfg(_identifier, defaultValues);
|
|
138
|
-
|
|
139
|
-
let logger = _self.diagLog();
|
|
140
|
-
_contentHandler = new DomContentHandler(_config, logger);
|
|
141
|
-
let metaTags = _contentHandler.getMetadata();
|
|
142
|
-
_pageAction = new PageAction(this, _config, _contentHandler, _config.callback.pageActionPageTags, metaTags, logger);
|
|
143
|
-
|
|
144
|
-
// Default to DOM autoCapture handler
|
|
145
|
-
if (_autoCaptureHandler) {
|
|
146
|
-
_autoCaptureHandler._doUnload();
|
|
147
|
-
}
|
|
148
|
-
_autoCaptureHandler = new AutoCaptureHandler(_self, _config, _pageAction, logger);
|
|
149
|
-
let autoCapture = !!_config.autoCapture;
|
|
150
|
-
if (!_autoCapture && autoCapture) {
|
|
151
|
-
_autoCaptureHandler.click();
|
|
152
|
-
}
|
|
153
|
-
_autoCapture = autoCapture;
|
|
154
|
-
}));
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function _initDefaults() {
|
|
158
|
-
_config = null;
|
|
159
|
-
_pageAction = null;
|
|
160
|
-
_autoCaptureHandler = null;
|
|
161
|
-
_contentHandler = null;
|
|
162
|
-
_autoCapture = false;
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
public initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain) {
|
|
168
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
public processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void {
|
|
172
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Logs a page action event.
|
|
177
|
-
* @param IPageActionTelemetry
|
|
178
|
-
* @param customProperties - Additional data used to filter events and metrics. Defaults to empty.
|
|
179
|
-
*/
|
|
180
|
-
public trackPageAction(pageAction?: IPageActionTelemetry, customProperties?: ICustomProperties) {
|
|
181
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
182
|
-
}
|
|
183
|
-
}
|