angulartics2 11.0.0 → 12.0.0
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/angular-router.d.ts +3 -0
- package/angulartics2-core.d.ts +3 -0
- package/angulartics2.d.ts +1 -0
- package/angulartics2.module.d.ts +5 -0
- package/angulartics2On.d.ts +6 -0
- package/esm2020/angular-router.mjs +33 -0
- package/{esm2015/angulartics2-config.js → esm2020/angulartics2-config.mjs} +0 -0
- package/esm2020/angulartics2-core.mjs +93 -0
- package/{esm2015/angulartics2-interfaces.js → esm2020/angulartics2-interfaces.mjs} +0 -0
- package/{esm2015/angulartics2-token.js → esm2020/angulartics2-token.mjs} +0 -0
- package/{esm2015/angulartics2.js → esm2020/angulartics2.mjs} +0 -0
- package/esm2020/angulartics2.module.mjs +30 -0
- package/esm2020/angulartics2On.mjs +66 -0
- package/esm2020/providers/adobeanalytics/adobeanalytics.mjs +98 -0
- package/esm2020/providers/amplitude/amplitude.mjs +68 -0
- package/esm2020/providers/appinsights/appinsights.mjs +118 -0
- package/esm2020/providers/baidu/baidu.mjs +81 -0
- package/{esm2015/providers/clicky/clicky.interfaces.js → esm2020/providers/clicky/clicky.interfaces.mjs} +0 -0
- package/esm2020/providers/clicky/clicky.mjs +64 -0
- package/esm2020/providers/facebook/facebook.mjs +45 -0
- package/esm2020/providers/ga/ga.mjs +219 -0
- package/{esm2015/providers/ga-enhanced-ecom/ga-enhanced-ecom-options.js → esm2020/providers/ga-enhanced-ecom/ga-enhanced-ecom-options.mjs} +0 -0
- package/esm2020/providers/ga-enhanced-ecom/ga-enhanced-ecom.mjs +32 -0
- package/esm2020/providers/gosquared/gosquared.mjs +55 -0
- package/{esm2015/providers/gst/gst-interfaces.js → esm2020/providers/gst/gst-interfaces.mjs} +0 -0
- package/esm2020/providers/gst/gst.mjs +197 -0
- package/esm2020/providers/gtm/gtm.mjs +114 -0
- package/esm2020/providers/hubspot/hubspot.mjs +40 -0
- package/esm2020/providers/ibm-digital-analytics/ibm-digital-analytics.mjs +125 -0
- package/esm2020/providers/intercom/intercom.mjs +60 -0
- package/esm2020/providers/kissmetrics/kissmetrics.mjs +40 -0
- package/esm2020/providers/launch/launch.mjs +59 -0
- package/esm2020/providers/matomo/matomo.mjs +303 -0
- package/esm2020/providers/mixpanel/mixpanel.mjs +109 -0
- package/esm2020/providers/pyze/pyze.mjs +65 -0
- package/esm2020/providers/segment/segment.mjs +100 -0
- package/esm2020/providers/splunk/splunk.mjs +46 -0
- package/esm2020/providers/woopra/woopra.mjs +61 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
- package/{esm2015/routerless.js → esm2020/routerless.mjs} +0 -0
- package/esm2020/routerless.module.mjs +28 -0
- package/fesm2015/{angulartics2.js → angulartics2.mjs} +201 -210
- package/fesm2015/angulartics2.mjs.map +1 -0
- package/fesm2020/angulartics2.mjs +2294 -0
- package/fesm2020/angulartics2.mjs.map +1 -0
- package/package.json +23 -11
- package/providers/adobeanalytics/README.md +12 -0
- package/providers/adobeanalytics/adobeanalytics.d.ts +3 -0
- package/providers/amplitude/README.md +12 -0
- package/providers/amplitude/amplitude.d.ts +3 -0
- package/providers/appinsights/README.md +12 -0
- package/providers/appinsights/appinsights.d.ts +3 -0
- package/providers/baidu/README.md +12 -0
- package/providers/baidu/baidu.d.ts +3 -0
- package/providers/clicky/README.md +93 -0
- package/providers/clicky/clicky.d.ts +3 -0
- package/providers/facebook/README.md +36 -0
- package/providers/facebook/facebook.d.ts +3 -0
- package/providers/ga/README.md +25 -0
- package/providers/ga/ga.d.ts +3 -0
- package/providers/ga-enhanced-ecom/README.md +12 -0
- package/providers/ga-enhanced-ecom/ga-enhanced-ecom.d.ts +3 -0
- package/providers/gosquared/README.md +12 -0
- package/providers/gosquared/gosquared.d.ts +3 -0
- package/providers/gst/README.md +110 -0
- package/providers/gst/gst.d.ts +3 -0
- package/providers/gtm/README.md +58 -0
- package/providers/gtm/gtm.d.ts +3 -0
- package/providers/hubspot/README.md +12 -0
- package/providers/hubspot/hubspot.d.ts +3 -0
- package/providers/ibm-digital-analytics/README.md +123 -0
- package/providers/ibm-digital-analytics/ibm-digital-analytics.d.ts +3 -0
- package/providers/intercom/README.md +12 -0
- package/providers/intercom/intercom.d.ts +3 -0
- package/providers/kissmetrics/README.md +12 -0
- package/providers/kissmetrics/kissmetrics.d.ts +3 -0
- package/providers/launch/README.md +59 -0
- package/providers/launch/launch.d.ts +3 -0
- package/providers/matomo/README.md +74 -0
- package/providers/matomo/matomo.d.ts +3 -0
- package/providers/mixpanel/README.md +105 -0
- package/providers/mixpanel/mixpanel.d.ts +3 -0
- package/providers/pyze/README.md +21 -0
- package/providers/pyze/pyze.d.ts +3 -0
- package/providers/segment/README.md +50 -0
- package/providers/segment/segment.d.ts +3 -0
- package/providers/splunk/README.md +57 -0
- package/providers/splunk/splunk.d.ts +3 -0
- package/providers/woopra/README.md +12 -0
- package/providers/woopra/woopra.d.ts +3 -0
- package/routerless.module.d.ts +5 -0
- package/angulartics2.metadata.json +0 -1
- package/bundles/angulartics2.umd.js +0 -2821
- package/bundles/angulartics2.umd.js.map +0 -1
- package/esm2015/angular-router.js +0 -36
- package/esm2015/angulartics2-core.js +0 -91
- package/esm2015/angulartics2.module.js +0 -25
- package/esm2015/angulartics2On.js +0 -55
- package/esm2015/providers/adobeanalytics/adobeanalytics.js +0 -102
- package/esm2015/providers/amplitude/amplitude.js +0 -70
- package/esm2015/providers/appinsights/appinsights.js +0 -120
- package/esm2015/providers/baidu/baidu.js +0 -83
- package/esm2015/providers/clicky/clicky.js +0 -68
- package/esm2015/providers/facebook/facebook.js +0 -47
- package/esm2015/providers/ga/ga.js +0 -208
- package/esm2015/providers/ga-enhanced-ecom/ga-enhanced-ecom.js +0 -30
- package/esm2015/providers/gosquared/gosquared.js +0 -57
- package/esm2015/providers/gst/gst.js +0 -182
- package/esm2015/providers/gtm/gtm.js +0 -107
- package/esm2015/providers/hubspot/hubspot.js +0 -42
- package/esm2015/providers/ibm-digital-analytics/ibm-digital-analytics.js +0 -127
- package/esm2015/providers/intercom/intercom.js +0 -62
- package/esm2015/providers/kissmetrics/kissmetrics.js +0 -42
- package/esm2015/providers/launch/launch.js +0 -61
- package/esm2015/providers/matomo/matomo.js +0 -305
- package/esm2015/providers/mixpanel/mixpanel.js +0 -111
- package/esm2015/providers/pyze/pyze.js +0 -67
- package/esm2015/providers/segment/segment.js +0 -102
- package/esm2015/providers/splunk/splunk.js +0 -48
- package/esm2015/providers/woopra/woopra.js +0 -63
- package/esm2015/routerless.module.js +0 -23
- package/fesm2015/angulartics2.js.map +0 -1
@@ -0,0 +1,2294 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { InjectionToken, Injectable, Inject, Directive, Input, NgModule } from '@angular/core';
|
3
|
+
import { BehaviorSubject, ReplaySubject } from 'rxjs';
|
4
|
+
import { filter, map, delay } from 'rxjs/operators';
|
5
|
+
import * as i1 from '@angular/router';
|
6
|
+
import { NavigationEnd, NavigationStart, NavigationError } from '@angular/router';
|
7
|
+
import * as i2 from '@angular/common';
|
8
|
+
import * as i2$1 from '@angular/platform-browser';
|
9
|
+
|
10
|
+
class DefaultConfig {
|
11
|
+
constructor() {
|
12
|
+
this.pageTracking = {
|
13
|
+
autoTrackVirtualPages: true,
|
14
|
+
basePath: '',
|
15
|
+
excludedRoutes: [],
|
16
|
+
clearIds: false,
|
17
|
+
clearHash: false,
|
18
|
+
clearQueryParams: false,
|
19
|
+
idsRegExp: /^\d+$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
20
|
+
};
|
21
|
+
this.developerMode = false;
|
22
|
+
this.ga = {};
|
23
|
+
this.appInsights = {};
|
24
|
+
this.gtm = {};
|
25
|
+
this.gst = {};
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
const ANGULARTICS2_TOKEN = new InjectionToken('ANGULARTICS2');
|
30
|
+
|
31
|
+
class RouterlessTracking {
|
32
|
+
trackLocation(settings) {
|
33
|
+
return new BehaviorSubject({ url: '/' });
|
34
|
+
}
|
35
|
+
prepareExternalUrl(url) {
|
36
|
+
return url;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
class Angulartics2 {
|
41
|
+
constructor(tracker, setup) {
|
42
|
+
this.tracker = tracker;
|
43
|
+
this.pageTrack = new ReplaySubject(10);
|
44
|
+
this.eventTrack = new ReplaySubject(10);
|
45
|
+
this.exceptionTrack = new ReplaySubject(10);
|
46
|
+
this.setAlias = new ReplaySubject(10);
|
47
|
+
this.setUsername = new ReplaySubject(10);
|
48
|
+
this.setUserProperties = new ReplaySubject(10);
|
49
|
+
this.setUserPropertiesOnce = new ReplaySubject(10);
|
50
|
+
this.setSuperProperties = new ReplaySubject(10);
|
51
|
+
this.setSuperPropertiesOnce = new ReplaySubject(10);
|
52
|
+
this.userTimings = new ReplaySubject(10);
|
53
|
+
const defaultConfig = new DefaultConfig();
|
54
|
+
this.settings = { ...defaultConfig, ...setup.settings };
|
55
|
+
this.settings.pageTracking = {
|
56
|
+
...defaultConfig.pageTracking,
|
57
|
+
...setup.settings.pageTracking,
|
58
|
+
};
|
59
|
+
this.tracker
|
60
|
+
.trackLocation(this.settings)
|
61
|
+
.subscribe((event) => this.trackUrlChange(event.url));
|
62
|
+
}
|
63
|
+
/** filters all events when developer mode is true */
|
64
|
+
filterDeveloperMode() {
|
65
|
+
return filter((value, index) => !this.settings.developerMode);
|
66
|
+
}
|
67
|
+
trackUrlChange(url) {
|
68
|
+
if (this.settings.pageTracking.autoTrackVirtualPages && !this.matchesExcludedRoute(url)) {
|
69
|
+
const clearedUrl = this.clearUrl(url);
|
70
|
+
let path;
|
71
|
+
if (this.settings.pageTracking.basePath.length) {
|
72
|
+
path = this.settings.pageTracking.basePath + clearedUrl;
|
73
|
+
}
|
74
|
+
else {
|
75
|
+
path = this.tracker.prepareExternalUrl(clearedUrl);
|
76
|
+
}
|
77
|
+
this.pageTrack.next({ path });
|
78
|
+
}
|
79
|
+
}
|
80
|
+
/**
|
81
|
+
* Use string literals or regular expressions to exclude routes
|
82
|
+
* from automatic pageview tracking.
|
83
|
+
*
|
84
|
+
* @param url location
|
85
|
+
*/
|
86
|
+
matchesExcludedRoute(url) {
|
87
|
+
for (const excludedRoute of this.settings.pageTracking.excludedRoutes) {
|
88
|
+
const matchesRegex = excludedRoute instanceof RegExp && excludedRoute.test(url);
|
89
|
+
if (matchesRegex || url.indexOf(excludedRoute) !== -1) {
|
90
|
+
return true;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
return false;
|
94
|
+
}
|
95
|
+
/**
|
96
|
+
* Removes id's from tracked route.
|
97
|
+
* EX: `/project/12981/feature` becomes `/project/feature`
|
98
|
+
*
|
99
|
+
* @param url current page path
|
100
|
+
*/
|
101
|
+
clearUrl(url) {
|
102
|
+
if (this.settings.pageTracking.clearIds ||
|
103
|
+
this.settings.pageTracking.clearQueryParams ||
|
104
|
+
this.settings.pageTracking.clearHash) {
|
105
|
+
return url
|
106
|
+
.split('/')
|
107
|
+
.map(part => (this.settings.pageTracking.clearQueryParams ? part.split('?')[0] : part))
|
108
|
+
.map(part => (this.settings.pageTracking.clearHash ? part.split('#')[0] : part))
|
109
|
+
.filter(part => !this.settings.pageTracking.clearIds ||
|
110
|
+
!part.match(this.settings.pageTracking.idsRegExp))
|
111
|
+
.join('/');
|
112
|
+
}
|
113
|
+
return url;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
Angulartics2.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2, deps: [{ token: RouterlessTracking }, { token: ANGULARTICS2_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
|
117
|
+
Angulartics2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2, providedIn: 'root' });
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2, decorators: [{
|
119
|
+
type: Injectable,
|
120
|
+
args: [{ providedIn: 'root' }]
|
121
|
+
}], ctorParameters: function () { return [{ type: RouterlessTracking }, { type: undefined, decorators: [{
|
122
|
+
type: Inject,
|
123
|
+
args: [ANGULARTICS2_TOKEN]
|
124
|
+
}] }]; } });
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Track Route changes for applications using Angular's
|
128
|
+
* default router
|
129
|
+
*
|
130
|
+
* @link https://angular.io/api/router/Router
|
131
|
+
*/
|
132
|
+
class AngularRouterTracking {
|
133
|
+
constructor(router, location) {
|
134
|
+
this.router = router;
|
135
|
+
this.location = location;
|
136
|
+
}
|
137
|
+
trackLocation(settings) {
|
138
|
+
return this.router.events.pipe(filter(e => e instanceof NavigationEnd), filter(() => !settings.developerMode), map((e) => {
|
139
|
+
return { url: e.urlAfterRedirects };
|
140
|
+
}), delay(0));
|
141
|
+
}
|
142
|
+
prepareExternalUrl(url) {
|
143
|
+
return this.location.prepareExternalUrl(url);
|
144
|
+
}
|
145
|
+
}
|
146
|
+
AngularRouterTracking.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: AngularRouterTracking, deps: [{ token: i1.Router }, { token: i2.Location }], target: i0.ɵɵFactoryTarget.Injectable });
|
147
|
+
AngularRouterTracking.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: AngularRouterTracking, providedIn: 'root' });
|
148
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: AngularRouterTracking, decorators: [{
|
149
|
+
type: Injectable,
|
150
|
+
args: [{ providedIn: 'root' }]
|
151
|
+
}], ctorParameters: function () { return [{ type: i1.Router }, { type: i2.Location }]; } });
|
152
|
+
|
153
|
+
class Angulartics2On {
|
154
|
+
constructor(elRef, angulartics2, renderer) {
|
155
|
+
this.elRef = elRef;
|
156
|
+
this.angulartics2 = angulartics2;
|
157
|
+
this.renderer = renderer;
|
158
|
+
this.angularticsProperties = {};
|
159
|
+
}
|
160
|
+
ngAfterContentInit() {
|
161
|
+
this.renderer.listen(this.elRef.nativeElement, this.angulartics2On || 'click', (event) => this.eventTrack(event));
|
162
|
+
}
|
163
|
+
eventTrack(event) {
|
164
|
+
const action = this.angularticsAction; // || this.inferEventName();
|
165
|
+
const properties = {
|
166
|
+
...this.angularticsProperties,
|
167
|
+
eventType: event.type,
|
168
|
+
};
|
169
|
+
if (this.angularticsCategory) {
|
170
|
+
properties.category = this.angularticsCategory;
|
171
|
+
}
|
172
|
+
if (this.angularticsLabel) {
|
173
|
+
properties.label = this.angularticsLabel;
|
174
|
+
}
|
175
|
+
if (this.angularticsValue) {
|
176
|
+
properties.value = this.angularticsValue;
|
177
|
+
}
|
178
|
+
this.angulartics2.eventTrack.next({
|
179
|
+
action,
|
180
|
+
properties,
|
181
|
+
});
|
182
|
+
}
|
183
|
+
}
|
184
|
+
Angulartics2On.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2On, deps: [{ token: i0.ElementRef }, { token: Angulartics2 }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
185
|
+
Angulartics2On.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.3", type: Angulartics2On, selector: "[angulartics2On]", inputs: { angulartics2On: "angulartics2On", angularticsAction: "angularticsAction", angularticsCategory: "angularticsCategory", angularticsLabel: "angularticsLabel", angularticsValue: "angularticsValue", angularticsProperties: "angularticsProperties" }, ngImport: i0 });
|
186
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2On, decorators: [{
|
187
|
+
type: Directive,
|
188
|
+
args: [{ selector: '[angulartics2On]' }]
|
189
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: Angulartics2 }, { type: i0.Renderer2 }]; }, propDecorators: { angulartics2On: [{
|
190
|
+
type: Input,
|
191
|
+
args: ['angulartics2On']
|
192
|
+
}], angularticsAction: [{
|
193
|
+
type: Input
|
194
|
+
}], angularticsCategory: [{
|
195
|
+
type: Input
|
196
|
+
}], angularticsLabel: [{
|
197
|
+
type: Input
|
198
|
+
}], angularticsValue: [{
|
199
|
+
type: Input
|
200
|
+
}], angularticsProperties: [{
|
201
|
+
type: Input
|
202
|
+
}] } });
|
203
|
+
class Angulartics2OnModule {
|
204
|
+
}
|
205
|
+
Angulartics2OnModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2OnModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
206
|
+
Angulartics2OnModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2OnModule, declarations: [Angulartics2On], exports: [Angulartics2On] });
|
207
|
+
Angulartics2OnModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2OnModule });
|
208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2OnModule, decorators: [{
|
209
|
+
type: NgModule,
|
210
|
+
args: [{
|
211
|
+
declarations: [Angulartics2On],
|
212
|
+
exports: [Angulartics2On],
|
213
|
+
}]
|
214
|
+
}] });
|
215
|
+
|
216
|
+
class Angulartics2Module {
|
217
|
+
static forRoot(settings = {}) {
|
218
|
+
return {
|
219
|
+
ngModule: Angulartics2Module,
|
220
|
+
providers: [
|
221
|
+
{ provide: ANGULARTICS2_TOKEN, useValue: { settings } },
|
222
|
+
{ provide: RouterlessTracking, useClass: AngularRouterTracking },
|
223
|
+
Angulartics2,
|
224
|
+
],
|
225
|
+
};
|
226
|
+
}
|
227
|
+
}
|
228
|
+
Angulartics2Module.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
229
|
+
Angulartics2Module.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Module, imports: [Angulartics2OnModule], exports: [Angulartics2On] });
|
230
|
+
Angulartics2Module.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Module, imports: [[Angulartics2OnModule]] });
|
231
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Module, decorators: [{
|
232
|
+
type: NgModule,
|
233
|
+
args: [{
|
234
|
+
imports: [Angulartics2OnModule],
|
235
|
+
exports: [Angulartics2On],
|
236
|
+
}]
|
237
|
+
}] });
|
238
|
+
|
239
|
+
class Angulartics2RouterlessModule {
|
240
|
+
static forRoot(settings = {}) {
|
241
|
+
return {
|
242
|
+
ngModule: Angulartics2RouterlessModule,
|
243
|
+
providers: [
|
244
|
+
{ provide: ANGULARTICS2_TOKEN, useValue: { settings } },
|
245
|
+
RouterlessTracking,
|
246
|
+
Angulartics2,
|
247
|
+
],
|
248
|
+
};
|
249
|
+
}
|
250
|
+
}
|
251
|
+
Angulartics2RouterlessModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2RouterlessModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
252
|
+
Angulartics2RouterlessModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2RouterlessModule, imports: [Angulartics2OnModule] });
|
253
|
+
Angulartics2RouterlessModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2RouterlessModule, imports: [[Angulartics2OnModule]] });
|
254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2RouterlessModule, decorators: [{
|
255
|
+
type: NgModule,
|
256
|
+
args: [{
|
257
|
+
imports: [Angulartics2OnModule],
|
258
|
+
}]
|
259
|
+
}] });
|
260
|
+
|
261
|
+
class Angulartics2AdobeAnalytics {
|
262
|
+
constructor(angulartics2, location) {
|
263
|
+
this.angulartics2 = angulartics2;
|
264
|
+
this.location = location;
|
265
|
+
this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));
|
266
|
+
}
|
267
|
+
startTracking() {
|
268
|
+
this.angulartics2.pageTrack
|
269
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
270
|
+
.subscribe(x => this.pageTrack(x.path));
|
271
|
+
this.angulartics2.eventTrack
|
272
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
273
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
274
|
+
}
|
275
|
+
pageTrack(path) {
|
276
|
+
if (typeof s !== 'undefined' && s) {
|
277
|
+
s.clearVars();
|
278
|
+
s.t({ pageName: path });
|
279
|
+
}
|
280
|
+
}
|
281
|
+
/**
|
282
|
+
* Track Event in Adobe Analytics
|
283
|
+
*
|
284
|
+
* @param action associated with the event
|
285
|
+
* @param properties action detials
|
286
|
+
*
|
287
|
+
* @link https://marketing.adobe.com/resources/help/en_US/sc/implement/js_implementation.html
|
288
|
+
*/
|
289
|
+
eventTrack(action, properties) {
|
290
|
+
// TODO: make interface
|
291
|
+
// @property {string} properties.category
|
292
|
+
// @property {string} properties.label
|
293
|
+
// @property {number} properties.value
|
294
|
+
// @property {boolean} properties.noninteraction
|
295
|
+
if (!properties) {
|
296
|
+
properties = properties || {};
|
297
|
+
}
|
298
|
+
if (typeof s !== 'undefined' && s) {
|
299
|
+
if (typeof properties === 'object') {
|
300
|
+
this.setUserProperties(properties);
|
301
|
+
}
|
302
|
+
if (action) {
|
303
|
+
// if linkName property is passed, use that; otherwise, the action is the linkName
|
304
|
+
const linkName = properties['linkName'] ? properties['linkName'] : action;
|
305
|
+
// note that 'this' should refer the link element, but we can't get that in this function. example:
|
306
|
+
// <a href="http://anothersite.com" onclick="s.tl(this,'e','AnotherSite',null)">
|
307
|
+
// if disableDelay property is passed, use that to turn off/on the 500ms delay; otherwise, it uses this
|
308
|
+
const disableDelay = !!properties['disableDelay'] ? true : this;
|
309
|
+
// if action property is passed, use that; otherwise, the action remains unchanged
|
310
|
+
if (properties['action']) {
|
311
|
+
action = properties['action'];
|
312
|
+
}
|
313
|
+
this.setPageName();
|
314
|
+
if (action.toUpperCase() === 'DOWNLOAD') {
|
315
|
+
s.tl(disableDelay, 'd', linkName);
|
316
|
+
}
|
317
|
+
else if (action.toUpperCase() === 'EXIT') {
|
318
|
+
s.tl(disableDelay, 'e', linkName);
|
319
|
+
}
|
320
|
+
else {
|
321
|
+
s.tl(disableDelay, 'o', linkName);
|
322
|
+
}
|
323
|
+
}
|
324
|
+
}
|
325
|
+
}
|
326
|
+
setPageName() {
|
327
|
+
const path = this.location.path(true);
|
328
|
+
const hashNdx = path.indexOf('#');
|
329
|
+
if (hashNdx > 0 && hashNdx < path.length) {
|
330
|
+
s.pageName = path.substring(hashNdx + 1);
|
331
|
+
}
|
332
|
+
else {
|
333
|
+
s.pageName = path;
|
334
|
+
}
|
335
|
+
}
|
336
|
+
setUserProperties(properties) {
|
337
|
+
if (typeof s !== 'undefined' && s) {
|
338
|
+
if (typeof properties === 'object') {
|
339
|
+
for (const key in properties) {
|
340
|
+
if (properties.hasOwnProperty(key)) {
|
341
|
+
s[key] = properties[key];
|
342
|
+
}
|
343
|
+
}
|
344
|
+
}
|
345
|
+
}
|
346
|
+
}
|
347
|
+
}
|
348
|
+
Angulartics2AdobeAnalytics.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2AdobeAnalytics, deps: [{ token: Angulartics2 }, { token: i2.Location }], target: i0.ɵɵFactoryTarget.Injectable });
|
349
|
+
Angulartics2AdobeAnalytics.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2AdobeAnalytics, providedIn: 'root' });
|
350
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2AdobeAnalytics, decorators: [{
|
351
|
+
type: Injectable,
|
352
|
+
args: [{ providedIn: 'root' }]
|
353
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }, { type: i2.Location }]; } });
|
354
|
+
|
355
|
+
class AppInsightsDefaults {
|
356
|
+
constructor() {
|
357
|
+
this.userId = null;
|
358
|
+
}
|
359
|
+
}
|
360
|
+
class Angulartics2AppInsights {
|
361
|
+
constructor(angulartics2, title, router) {
|
362
|
+
this.angulartics2 = angulartics2;
|
363
|
+
this.title = title;
|
364
|
+
this.router = router;
|
365
|
+
this.loadStartTime = null;
|
366
|
+
this.loadTime = null;
|
367
|
+
this.metrics = null;
|
368
|
+
this.dimensions = null;
|
369
|
+
this.measurements = null;
|
370
|
+
if (typeof appInsights === 'undefined') {
|
371
|
+
console.warn('appInsights not found');
|
372
|
+
}
|
373
|
+
const defaults = new AppInsightsDefaults();
|
374
|
+
// Set the default settings for this module
|
375
|
+
this.angulartics2.settings.appInsights = {
|
376
|
+
...defaults,
|
377
|
+
...this.angulartics2.settings.appInsights,
|
378
|
+
};
|
379
|
+
this.angulartics2.setUsername.subscribe((x) => this.setUsername(x));
|
380
|
+
this.angulartics2.setUserProperties.subscribe((x) => this.setUserProperties(x));
|
381
|
+
}
|
382
|
+
startTracking() {
|
383
|
+
this.angulartics2.pageTrack
|
384
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
385
|
+
.subscribe((x) => this.pageTrack(x.path));
|
386
|
+
this.angulartics2.eventTrack
|
387
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
388
|
+
.subscribe((x) => this.eventTrack(x.action, x.properties));
|
389
|
+
this.angulartics2.exceptionTrack
|
390
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
391
|
+
.subscribe((x) => this.exceptionTrack(x));
|
392
|
+
this.router.events
|
393
|
+
.pipe(this.angulartics2.filterDeveloperMode(), filter((event) => event instanceof NavigationStart))
|
394
|
+
.subscribe((event) => this.startTimer());
|
395
|
+
this.router.events
|
396
|
+
.pipe(filter((event) => event instanceof NavigationError || event instanceof NavigationEnd))
|
397
|
+
.subscribe((error) => this.stopTimer());
|
398
|
+
}
|
399
|
+
startTimer() {
|
400
|
+
this.loadStartTime = Date.now();
|
401
|
+
this.loadTime = null;
|
402
|
+
}
|
403
|
+
stopTimer() {
|
404
|
+
this.loadTime = Date.now() - this.loadStartTime;
|
405
|
+
this.loadStartTime = null;
|
406
|
+
}
|
407
|
+
/**
|
408
|
+
* Page Track in Baidu Analytics
|
409
|
+
*
|
410
|
+
* @param path - Location 'path'
|
411
|
+
*
|
412
|
+
* @link https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#trackpageview
|
413
|
+
*/
|
414
|
+
pageTrack(path) {
|
415
|
+
appInsights.trackPageView(this.title.getTitle(), path, this.dimensions, this.metrics, this.loadTime);
|
416
|
+
}
|
417
|
+
/**
|
418
|
+
* Log a user action or other occurrence.
|
419
|
+
*
|
420
|
+
* @param name Name to identify this event in the portal.
|
421
|
+
* @param properties Additional data used to filter events and metrics in the portal. Defaults to empty.
|
422
|
+
*
|
423
|
+
* @link https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#trackevent
|
424
|
+
*/
|
425
|
+
eventTrack(name, properties) {
|
426
|
+
appInsights.trackEvent(name, properties, this.measurements);
|
427
|
+
}
|
428
|
+
/**
|
429
|
+
* Exception Track Event in GA
|
430
|
+
*
|
431
|
+
* @param properties - Comprised of the mandatory fields 'appId' (string), 'appName' (string) and 'appVersion' (string) and
|
432
|
+
* optional fields 'fatal' (boolean) and 'description' (string), error
|
433
|
+
*
|
434
|
+
* @link https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#trackexception
|
435
|
+
*/
|
436
|
+
exceptionTrack(properties) {
|
437
|
+
const description = properties.event || properties.description || properties;
|
438
|
+
appInsights.trackException(description);
|
439
|
+
}
|
440
|
+
/**
|
441
|
+
* @link https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#setauthenticatedusercontext
|
442
|
+
*/
|
443
|
+
setUsername(userId) {
|
444
|
+
this.angulartics2.settings.appInsights.userId = userId;
|
445
|
+
appInsights.setAuthenticatedUserContext(userId);
|
446
|
+
}
|
447
|
+
setUserProperties(properties) {
|
448
|
+
if (properties.userId) {
|
449
|
+
this.angulartics2.settings.appInsights.userId = properties.userId;
|
450
|
+
}
|
451
|
+
if (properties.accountId) {
|
452
|
+
appInsights.setAuthenticatedUserContext(this.angulartics2.settings.appInsights.userId, properties.accountId);
|
453
|
+
}
|
454
|
+
else {
|
455
|
+
appInsights.setAuthenticatedUserContext(this.angulartics2.settings.appInsights.userId);
|
456
|
+
}
|
457
|
+
}
|
458
|
+
}
|
459
|
+
Angulartics2AppInsights.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2AppInsights, deps: [{ token: Angulartics2 }, { token: i2$1.Title }, { token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
460
|
+
Angulartics2AppInsights.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2AppInsights, providedIn: 'root' });
|
461
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2AppInsights, decorators: [{
|
462
|
+
type: Injectable,
|
463
|
+
args: [{ providedIn: 'root' }]
|
464
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }, { type: i2$1.Title }, { type: i1.Router }]; } });
|
465
|
+
|
466
|
+
class Angulartics2BaiduAnalytics {
|
467
|
+
constructor(angulartics2) {
|
468
|
+
this.angulartics2 = angulartics2;
|
469
|
+
if (typeof _hmt === 'undefined') {
|
470
|
+
_hmt = [];
|
471
|
+
}
|
472
|
+
else {
|
473
|
+
_hmt.push(['_setAutoPageview', false]);
|
474
|
+
}
|
475
|
+
this.angulartics2.setUsername
|
476
|
+
.subscribe((x) => this.setUsername(x));
|
477
|
+
this.angulartics2.setUserProperties
|
478
|
+
.subscribe((x) => this.setUserProperties(x));
|
479
|
+
}
|
480
|
+
startTracking() {
|
481
|
+
this.angulartics2.pageTrack
|
482
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
483
|
+
.subscribe((x) => this.pageTrack(x.path));
|
484
|
+
this.angulartics2.eventTrack
|
485
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
486
|
+
.subscribe((x) => this.eventTrack(x.action, x.properties));
|
487
|
+
}
|
488
|
+
/**
|
489
|
+
* Page Track in Baidu Analytics
|
490
|
+
*
|
491
|
+
* @param path Required url 'path'
|
492
|
+
*
|
493
|
+
* @link http://tongji.baidu.com/open/api/more?p=ref_trackPageview
|
494
|
+
*/
|
495
|
+
pageTrack(path) {
|
496
|
+
if (typeof _hmt !== 'undefined' && _hmt) {
|
497
|
+
_hmt.push(['_trackPageview', path]);
|
498
|
+
}
|
499
|
+
}
|
500
|
+
/**
|
501
|
+
* Track Event in Baidu Analytics
|
502
|
+
*
|
503
|
+
* @param action Name associated with the event
|
504
|
+
* @param properties Comprised of:
|
505
|
+
* - 'category' (string)
|
506
|
+
* - 'opt_label' (string)
|
507
|
+
* - 'opt_value' (string)
|
508
|
+
*
|
509
|
+
* @link http://tongji.baidu.com/open/api/more?p=ref_trackEvent
|
510
|
+
*/
|
511
|
+
eventTrack(action, properties) {
|
512
|
+
// baidu analytics requires category
|
513
|
+
if (!properties || !properties.category) {
|
514
|
+
properties = properties || {};
|
515
|
+
properties.category = 'Event';
|
516
|
+
properties.opt_label = 'default';
|
517
|
+
properties.opt_value = 'default';
|
518
|
+
}
|
519
|
+
if (typeof _hmt !== 'undefined' && _hmt) {
|
520
|
+
_hmt.push([
|
521
|
+
'_trackEvent',
|
522
|
+
properties.category,
|
523
|
+
action,
|
524
|
+
properties.opt_label,
|
525
|
+
properties.opt_value,
|
526
|
+
]);
|
527
|
+
}
|
528
|
+
}
|
529
|
+
setUsername(userId) {
|
530
|
+
// set default custom variables name to 'identity' and 'value'
|
531
|
+
_hmt.push(['_setCustomVar', 1, 'identity', userId]);
|
532
|
+
}
|
533
|
+
setUserProperties(properties) {
|
534
|
+
_hmt.push(['_setCustomVar', 2, 'user', JSON.stringify(properties)]);
|
535
|
+
}
|
536
|
+
}
|
537
|
+
Angulartics2BaiduAnalytics.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2BaiduAnalytics, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
538
|
+
Angulartics2BaiduAnalytics.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2BaiduAnalytics, providedIn: 'root' });
|
539
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2BaiduAnalytics, decorators: [{
|
540
|
+
type: Injectable,
|
541
|
+
args: [{ providedIn: 'root' }]
|
542
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
543
|
+
|
544
|
+
const facebookEventList = [
|
545
|
+
'ViewContent',
|
546
|
+
'Search',
|
547
|
+
'AddToCart',
|
548
|
+
'AddToWishlist',
|
549
|
+
'InitiateCheckout',
|
550
|
+
'AddPaymentInfo',
|
551
|
+
'Purchase',
|
552
|
+
'Lead',
|
553
|
+
'CompleteRegistration',
|
554
|
+
];
|
555
|
+
class Angulartics2Facebook {
|
556
|
+
constructor(angulartics2) {
|
557
|
+
this.angulartics2 = angulartics2;
|
558
|
+
}
|
559
|
+
startTracking() {
|
560
|
+
this.angulartics2.eventTrack
|
561
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
562
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
563
|
+
}
|
564
|
+
/**
|
565
|
+
* Send interactions to the Pixel, i.e. for event tracking in Pixel
|
566
|
+
*
|
567
|
+
* @param action action associated with the event
|
568
|
+
*/
|
569
|
+
eventTrack(action, properties = {}) {
|
570
|
+
if (typeof fbq === 'undefined') {
|
571
|
+
return;
|
572
|
+
}
|
573
|
+
if (facebookEventList.indexOf(action) === -1) {
|
574
|
+
return fbq('trackCustom', action, properties);
|
575
|
+
}
|
576
|
+
return fbq('track', action, properties);
|
577
|
+
}
|
578
|
+
}
|
579
|
+
Angulartics2Facebook.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Facebook, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
580
|
+
Angulartics2Facebook.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Facebook, providedIn: 'root' });
|
581
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Facebook, decorators: [{
|
582
|
+
type: Injectable,
|
583
|
+
args: [{ providedIn: 'root' }]
|
584
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
585
|
+
|
586
|
+
class GoogleAnalyticsDefaults {
|
587
|
+
constructor() {
|
588
|
+
this.additionalAccountNames = [];
|
589
|
+
this.userId = null;
|
590
|
+
this.transport = '';
|
591
|
+
this.anonymizeIp = false;
|
592
|
+
}
|
593
|
+
}
|
594
|
+
class Angulartics2GoogleAnalytics {
|
595
|
+
constructor(angulartics2) {
|
596
|
+
this.angulartics2 = angulartics2;
|
597
|
+
this.dimensionsAndMetrics = [];
|
598
|
+
const defaults = new GoogleAnalyticsDefaults();
|
599
|
+
// Set the default settings for this module
|
600
|
+
this.angulartics2.settings.ga = {
|
601
|
+
...defaults,
|
602
|
+
...this.angulartics2.settings.ga,
|
603
|
+
};
|
604
|
+
this.settings = this.angulartics2.settings.ga;
|
605
|
+
this.angulartics2.setUsername.subscribe((x) => this.setUsername(x));
|
606
|
+
this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));
|
607
|
+
}
|
608
|
+
startTracking() {
|
609
|
+
this.angulartics2.pageTrack
|
610
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
611
|
+
.subscribe(x => this.pageTrack(x.path));
|
612
|
+
this.angulartics2.eventTrack
|
613
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
614
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
615
|
+
this.angulartics2.exceptionTrack
|
616
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
617
|
+
.subscribe(x => this.exceptionTrack(x));
|
618
|
+
this.angulartics2.userTimings
|
619
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
620
|
+
.subscribe(x => this.userTimings(x));
|
621
|
+
}
|
622
|
+
pageTrack(path) {
|
623
|
+
if (typeof _gaq !== 'undefined' && _gaq) {
|
624
|
+
_gaq.push(['_trackPageview', path]);
|
625
|
+
for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {
|
626
|
+
_gaq.push([accountName + '._trackPageview', path]);
|
627
|
+
}
|
628
|
+
}
|
629
|
+
if (typeof ga !== 'undefined' && ga) {
|
630
|
+
if (this.angulartics2.settings.ga.userId) {
|
631
|
+
ga('set', '&uid', this.angulartics2.settings.ga.userId);
|
632
|
+
for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {
|
633
|
+
ga(accountName + '.set', '&uid', this.angulartics2.settings.ga.userId);
|
634
|
+
}
|
635
|
+
}
|
636
|
+
if (this.angulartics2.settings.ga.anonymizeIp) {
|
637
|
+
ga('set', 'anonymizeIp', true);
|
638
|
+
for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {
|
639
|
+
ga(accountName + '.set', 'anonymizeIp', true);
|
640
|
+
}
|
641
|
+
}
|
642
|
+
ga('send', 'pageview', path);
|
643
|
+
for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {
|
644
|
+
ga(accountName + '.send', 'pageview', path);
|
645
|
+
}
|
646
|
+
}
|
647
|
+
}
|
648
|
+
/**
|
649
|
+
* Track Event in GA
|
650
|
+
*
|
651
|
+
* @param action Associated with the event
|
652
|
+
* @param properties Comprised of:
|
653
|
+
* - category (string) and optional
|
654
|
+
* - label (string)
|
655
|
+
* - value (integer)
|
656
|
+
* - noninteraction (boolean)
|
657
|
+
*
|
658
|
+
* @link https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#SettingUpEventTracking
|
659
|
+
* @link https://developers.google.com/analytics/devguides/collection/analyticsjs/events
|
660
|
+
*/
|
661
|
+
eventTrack(action, properties) {
|
662
|
+
// Google Analytics requires an Event Category
|
663
|
+
if (!properties || !properties.category) {
|
664
|
+
properties = properties || {};
|
665
|
+
properties.category = 'Event';
|
666
|
+
}
|
667
|
+
// GA requires that eventValue be an integer, see:
|
668
|
+
// https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#eventValue
|
669
|
+
// https://github.com/luisfarzati/angulartics/issues/81
|
670
|
+
if (properties.value) {
|
671
|
+
const parsed = parseInt(properties.value, 10);
|
672
|
+
properties.value = isNaN(parsed) ? 0 : parsed;
|
673
|
+
}
|
674
|
+
if (typeof ga !== 'undefined') {
|
675
|
+
const eventOptions = {
|
676
|
+
eventCategory: properties.category,
|
677
|
+
eventAction: action,
|
678
|
+
eventLabel: properties.label,
|
679
|
+
eventValue: properties.value,
|
680
|
+
nonInteraction: properties.noninteraction,
|
681
|
+
page: properties.page || location.hash.substring(1) || location.pathname,
|
682
|
+
userId: this.angulartics2.settings.ga.userId,
|
683
|
+
hitCallback: properties.hitCallback,
|
684
|
+
...(this.angulartics2.settings.ga.transport && {
|
685
|
+
transport: this.angulartics2.settings.ga.transport,
|
686
|
+
}),
|
687
|
+
};
|
688
|
+
// add custom dimensions and metrics
|
689
|
+
this.setDimensionsAndMetrics(properties);
|
690
|
+
ga('send', 'event', eventOptions);
|
691
|
+
for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {
|
692
|
+
ga(accountName + '.send', 'event', eventOptions);
|
693
|
+
}
|
694
|
+
}
|
695
|
+
else if (typeof _gaq !== 'undefined') {
|
696
|
+
_gaq.push([
|
697
|
+
'_trackEvent',
|
698
|
+
properties.category,
|
699
|
+
action,
|
700
|
+
properties.label,
|
701
|
+
properties.value,
|
702
|
+
properties.noninteraction,
|
703
|
+
]);
|
704
|
+
}
|
705
|
+
}
|
706
|
+
/**
|
707
|
+
* Exception Track Event in GA
|
708
|
+
*
|
709
|
+
* @param properties Comprised of the optional fields:
|
710
|
+
* - fatal (string)
|
711
|
+
* - description (string)
|
712
|
+
*
|
713
|
+
* @https://developers.google.com/analytics/devguides/collection/analyticsjs/exceptions
|
714
|
+
*
|
715
|
+
* @link https://developers.google.com/analytics/devguides/collection/analyticsjs/events
|
716
|
+
*/
|
717
|
+
exceptionTrack(properties) {
|
718
|
+
if (properties.fatal === undefined) {
|
719
|
+
console.log('No "fatal" provided, sending with fatal=true');
|
720
|
+
properties.fatal = true;
|
721
|
+
}
|
722
|
+
properties.exDescription = properties.description;
|
723
|
+
const eventOptions = {
|
724
|
+
exFatal: properties.fatal,
|
725
|
+
exDescription: properties.description,
|
726
|
+
};
|
727
|
+
ga('send', 'exception', eventOptions);
|
728
|
+
for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {
|
729
|
+
ga(accountName + '.send', 'exception', eventOptions);
|
730
|
+
}
|
731
|
+
}
|
732
|
+
/**
|
733
|
+
* User Timings Event in GA
|
734
|
+
*
|
735
|
+
* @param properties Comprised of the mandatory fields:
|
736
|
+
* - timingCategory (string)
|
737
|
+
* - timingVar (string)
|
738
|
+
* - timingValue (number)
|
739
|
+
* Properties can also have the optional fields:
|
740
|
+
* - timingLabel (string)
|
741
|
+
*
|
742
|
+
* @link https://developers.google.com/analytics/devguides/collection/analyticsjs/user-timings
|
743
|
+
*/
|
744
|
+
userTimings(properties) {
|
745
|
+
if (!properties ||
|
746
|
+
!properties.timingCategory ||
|
747
|
+
!properties.timingVar ||
|
748
|
+
!properties.timingValue) {
|
749
|
+
console.error('Properties timingCategory, timingVar, and timingValue are required to be set.');
|
750
|
+
return;
|
751
|
+
}
|
752
|
+
if (typeof ga !== 'undefined') {
|
753
|
+
ga('send', 'timing', properties);
|
754
|
+
for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {
|
755
|
+
ga(accountName + '.send', 'timing', properties);
|
756
|
+
}
|
757
|
+
}
|
758
|
+
}
|
759
|
+
setUsername(userId) {
|
760
|
+
this.angulartics2.settings.ga.userId = userId;
|
761
|
+
if (typeof ga === 'undefined') {
|
762
|
+
return;
|
763
|
+
}
|
764
|
+
ga('set', 'userId', userId);
|
765
|
+
}
|
766
|
+
setUserProperties(properties) {
|
767
|
+
this.setDimensionsAndMetrics(properties);
|
768
|
+
}
|
769
|
+
setDimensionsAndMetrics(properties) {
|
770
|
+
if (typeof ga === 'undefined') {
|
771
|
+
return;
|
772
|
+
}
|
773
|
+
// clean previously used dimensions and metrics that will not be overriden
|
774
|
+
this.dimensionsAndMetrics.forEach(elem => {
|
775
|
+
if (!properties.hasOwnProperty(elem)) {
|
776
|
+
ga('set', elem, undefined);
|
777
|
+
this.angulartics2.settings.ga.additionalAccountNames.forEach((accountName) => {
|
778
|
+
ga(`${accountName}.set`, elem, undefined);
|
779
|
+
});
|
780
|
+
}
|
781
|
+
});
|
782
|
+
this.dimensionsAndMetrics = [];
|
783
|
+
// add custom dimensions and metrics
|
784
|
+
Object.keys(properties).forEach(key => {
|
785
|
+
if (key.lastIndexOf('dimension', 0) === 0 || key.lastIndexOf('metric', 0) === 0) {
|
786
|
+
ga('set', key, properties[key]);
|
787
|
+
this.angulartics2.settings.ga.additionalAccountNames.forEach((accountName) => {
|
788
|
+
ga(`${accountName}.set`, key, properties[key]);
|
789
|
+
});
|
790
|
+
this.dimensionsAndMetrics.push(key);
|
791
|
+
}
|
792
|
+
});
|
793
|
+
}
|
794
|
+
}
|
795
|
+
Angulartics2GoogleAnalytics.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoogleAnalytics, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
796
|
+
Angulartics2GoogleAnalytics.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoogleAnalytics, providedIn: 'root' });
|
797
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoogleAnalytics, decorators: [{
|
798
|
+
type: Injectable,
|
799
|
+
args: [{ providedIn: 'root' }]
|
800
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
801
|
+
|
802
|
+
class Angulartics2GoogleAnalyticsEnhancedEcommerce {
|
803
|
+
/**
|
804
|
+
* Add impression in GA enhanced ecommerce tracking
|
805
|
+
* @link https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-activities
|
806
|
+
*/
|
807
|
+
ecAddImpression(properties) {
|
808
|
+
ga('ec:addImpression', properties);
|
809
|
+
}
|
810
|
+
/**
|
811
|
+
* Add product in GA enhanced ecommerce tracking
|
812
|
+
* @link https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
|
813
|
+
*/
|
814
|
+
ecAddProduct(product) {
|
815
|
+
ga('ec:addProduct', product);
|
816
|
+
}
|
817
|
+
/**
|
818
|
+
* Set action in GA enhanced ecommerce tracking
|
819
|
+
* @link https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
|
820
|
+
*/
|
821
|
+
ecSetAction(action, properties) {
|
822
|
+
ga('ec:setAction', action, properties);
|
823
|
+
}
|
824
|
+
}
|
825
|
+
Angulartics2GoogleAnalyticsEnhancedEcommerce.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoogleAnalyticsEnhancedEcommerce, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
826
|
+
Angulartics2GoogleAnalyticsEnhancedEcommerce.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoogleAnalyticsEnhancedEcommerce, providedIn: 'root' });
|
827
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoogleAnalyticsEnhancedEcommerce, decorators: [{
|
828
|
+
type: Injectable,
|
829
|
+
args: [{ providedIn: 'root' }]
|
830
|
+
}] });
|
831
|
+
|
832
|
+
class GoogleTagManagerDefaults {
|
833
|
+
constructor() {
|
834
|
+
this.userId = null;
|
835
|
+
}
|
836
|
+
}
|
837
|
+
class Angulartics2GoogleTagManager {
|
838
|
+
constructor(angulartics2) {
|
839
|
+
this.angulartics2 = angulartics2;
|
840
|
+
// The dataLayer needs to be initialized
|
841
|
+
if (typeof dataLayer !== 'undefined' && dataLayer) {
|
842
|
+
dataLayer = window.dataLayer = window.dataLayer || [];
|
843
|
+
}
|
844
|
+
const defaults = new GoogleTagManagerDefaults();
|
845
|
+
// Set the default settings for this module
|
846
|
+
this.angulartics2.settings.gtm = { ...defaults, ...this.angulartics2.settings.gtm };
|
847
|
+
this.angulartics2.setUsername.subscribe((x) => this.setUsername(x));
|
848
|
+
}
|
849
|
+
startTracking() {
|
850
|
+
this.angulartics2.pageTrack
|
851
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
852
|
+
.subscribe(x => this.pageTrack(x.path));
|
853
|
+
this.angulartics2.eventTrack
|
854
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
855
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
856
|
+
this.angulartics2.exceptionTrack
|
857
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
858
|
+
.subscribe((x) => this.exceptionTrack(x));
|
859
|
+
}
|
860
|
+
pageTrack(path) {
|
861
|
+
this.pushLayer({
|
862
|
+
event: 'Page View',
|
863
|
+
'content-name': path,
|
864
|
+
userId: this.angulartics2.settings.gtm.userId,
|
865
|
+
});
|
866
|
+
}
|
867
|
+
/**
|
868
|
+
* Send Data Layer
|
869
|
+
*
|
870
|
+
* @layer data layer object
|
871
|
+
*/
|
872
|
+
pushLayer(layer) {
|
873
|
+
if (typeof dataLayer !== 'undefined' && dataLayer) {
|
874
|
+
dataLayer.push(layer);
|
875
|
+
}
|
876
|
+
}
|
877
|
+
/**
|
878
|
+
* Send interactions to the dataLayer, i.e. for event tracking in Google Analytics
|
879
|
+
*
|
880
|
+
* @param action associated with the event
|
881
|
+
*/
|
882
|
+
eventTrack(action, properties) {
|
883
|
+
// TODO: make interface
|
884
|
+
// @param {string} properties.category
|
885
|
+
// @param {string} [properties.label]
|
886
|
+
// @param {number} [properties.value]
|
887
|
+
// @param {boolean} [properties.noninteraction]
|
888
|
+
// Set a default GTM category
|
889
|
+
properties = properties || {};
|
890
|
+
this.pushLayer({
|
891
|
+
event: properties.event || 'interaction',
|
892
|
+
target: properties.category || 'Event',
|
893
|
+
action,
|
894
|
+
label: properties.label,
|
895
|
+
value: properties.value,
|
896
|
+
interactionType: properties.noninteraction,
|
897
|
+
userId: this.angulartics2.settings.gtm.userId,
|
898
|
+
...properties.gtmCustom,
|
899
|
+
});
|
900
|
+
}
|
901
|
+
/**
|
902
|
+
* Exception Track Event in GTM
|
903
|
+
*
|
904
|
+
*/
|
905
|
+
exceptionTrack(properties) {
|
906
|
+
// TODO: make interface
|
907
|
+
// @param {Object} properties
|
908
|
+
// @param {string} properties.appId
|
909
|
+
// @param {string} properties.appName
|
910
|
+
// @param {string} properties.appVersion
|
911
|
+
// @param {string} [properties.description]
|
912
|
+
// @param {boolean} [properties.fatal]
|
913
|
+
if (!properties || !properties.appId || !properties.appName || !properties.appVersion) {
|
914
|
+
console.error('Must be setted appId, appName and appVersion.');
|
915
|
+
return;
|
916
|
+
}
|
917
|
+
if (properties.fatal === undefined) {
|
918
|
+
console.log('No "fatal" provided, sending with fatal=true');
|
919
|
+
properties.exFatal = true;
|
920
|
+
}
|
921
|
+
properties.exDescription = properties.event ? properties.event.stack : properties.description;
|
922
|
+
this.eventTrack(`Exception thrown for ${properties.appName} <${properties.appId}@${properties.appVersion}>`, {
|
923
|
+
category: 'Exception',
|
924
|
+
label: properties.exDescription,
|
925
|
+
});
|
926
|
+
}
|
927
|
+
/**
|
928
|
+
* Set userId for use with Universal Analytics User ID feature
|
929
|
+
*
|
930
|
+
* @param userId used to identify user cross-device in Google Analytics
|
931
|
+
*/
|
932
|
+
setUsername(userId) {
|
933
|
+
this.angulartics2.settings.gtm.userId = userId;
|
934
|
+
}
|
935
|
+
}
|
936
|
+
Angulartics2GoogleTagManager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoogleTagManager, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
937
|
+
Angulartics2GoogleTagManager.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoogleTagManager, providedIn: 'root' });
|
938
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoogleTagManager, decorators: [{
|
939
|
+
type: Injectable,
|
940
|
+
args: [{ providedIn: 'root' }]
|
941
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
942
|
+
|
943
|
+
class GoogleGlobalSiteTagDefaults {
|
944
|
+
constructor() {
|
945
|
+
this.trackingIds = [];
|
946
|
+
if (typeof ga !== 'undefined' && ga) {
|
947
|
+
// See: https://developers.google.com/analytics/devguides/collection/analyticsjs/ga-object-methods-reference
|
948
|
+
ga(() => {
|
949
|
+
ga.getAll().forEach((tracker) => {
|
950
|
+
const id = tracker.get('trackingId');
|
951
|
+
// If set both in forRoot and HTML page, we want to avoid duplicates
|
952
|
+
if (id !== undefined && this.trackingIds.indexOf(id) === -1) {
|
953
|
+
this.trackingIds.push(id);
|
954
|
+
}
|
955
|
+
});
|
956
|
+
});
|
957
|
+
}
|
958
|
+
}
|
959
|
+
}
|
960
|
+
class Angulartics2GoogleGlobalSiteTag {
|
961
|
+
constructor(angulartics2) {
|
962
|
+
this.angulartics2 = angulartics2;
|
963
|
+
this.dimensionsAndMetrics = {};
|
964
|
+
const defaults = new GoogleGlobalSiteTagDefaults();
|
965
|
+
// Set the default settings for this module
|
966
|
+
this.angulartics2.settings.gst = { ...defaults, ...this.angulartics2.settings.gst };
|
967
|
+
}
|
968
|
+
startTracking() {
|
969
|
+
this.angulartics2.pageTrack
|
970
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
971
|
+
.subscribe(x => this.pageTrack(x.path));
|
972
|
+
this.angulartics2.eventTrack
|
973
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
974
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
975
|
+
this.angulartics2.exceptionTrack
|
976
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
977
|
+
.subscribe((x) => this.exceptionTrack(x));
|
978
|
+
this.angulartics2.userTimings
|
979
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
980
|
+
.subscribe(x => this.userTimings(this.convertTimings(x)));
|
981
|
+
this.angulartics2.setUsername
|
982
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
983
|
+
.subscribe((x) => this.setUsername(x));
|
984
|
+
this.angulartics2.setUserProperties
|
985
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
986
|
+
.subscribe((x) => this.setUserProperties(x));
|
987
|
+
}
|
988
|
+
/**
|
989
|
+
* Manually track page view, see:
|
990
|
+
*
|
991
|
+
* https://developers.google.com/analytics/devguides/collection/gtagjs/single-page-applications#tracking_virtual_pageviews
|
992
|
+
*
|
993
|
+
* @param path relative url
|
994
|
+
*/
|
995
|
+
pageTrack(path) {
|
996
|
+
if (typeof gtag !== 'undefined' && gtag) {
|
997
|
+
const params = {
|
998
|
+
page_path: path,
|
999
|
+
page_location: window.location.protocol + '//' + window.location.host + path,
|
1000
|
+
...this.dimensionsAndMetrics,
|
1001
|
+
};
|
1002
|
+
// Custom map must be reset with all config to stay valid.
|
1003
|
+
if (this.angulartics2.settings.gst.customMap) {
|
1004
|
+
params.custom_map = this.angulartics2.settings.gst.customMap;
|
1005
|
+
}
|
1006
|
+
if (this.angulartics2.settings.gst.userId) {
|
1007
|
+
params.user_id = this.angulartics2.settings.gst.userId;
|
1008
|
+
}
|
1009
|
+
if (this.angulartics2.settings.gst.anonymizeIp) {
|
1010
|
+
params.anonymize_ip = this.angulartics2.settings.gst.anonymizeIp;
|
1011
|
+
}
|
1012
|
+
for (const id of this.angulartics2.settings.gst.trackingIds) {
|
1013
|
+
gtag('config', id, params);
|
1014
|
+
}
|
1015
|
+
}
|
1016
|
+
}
|
1017
|
+
/**
|
1018
|
+
* Send interactions to gtag, i.e. for event tracking in Google Analytics. See:
|
1019
|
+
*
|
1020
|
+
* https://developers.google.com/analytics/devguides/collection/gtagjs/events
|
1021
|
+
*
|
1022
|
+
* @param action associated with the event
|
1023
|
+
*/
|
1024
|
+
eventTrack(action, properties = {}) {
|
1025
|
+
this.eventTrackInternal(action, {
|
1026
|
+
event_category: properties.category || 'interaction',
|
1027
|
+
event_label: properties.label,
|
1028
|
+
value: properties.value,
|
1029
|
+
non_interaction: properties.noninteraction,
|
1030
|
+
...properties.gstCustom,
|
1031
|
+
});
|
1032
|
+
}
|
1033
|
+
/**
|
1034
|
+
* Exception Track Event in GST. See:
|
1035
|
+
*
|
1036
|
+
* https://developers.google.com/analytics/devguides/collection/gtagjs/exceptions
|
1037
|
+
*
|
1038
|
+
*/
|
1039
|
+
exceptionTrack(properties) {
|
1040
|
+
// TODO: make interface
|
1041
|
+
// @param {Object} properties
|
1042
|
+
// @param {string} [properties.description]
|
1043
|
+
// @param {boolean} [properties.fatal]
|
1044
|
+
if (properties.fatal === undefined) {
|
1045
|
+
console.log('No "fatal" provided, sending with fatal=true');
|
1046
|
+
properties.fatal = true;
|
1047
|
+
}
|
1048
|
+
properties.exDescription = properties.event ? properties.event.stack : properties.description;
|
1049
|
+
this.eventTrack('exception', {
|
1050
|
+
gstCustom: {
|
1051
|
+
description: properties.exDescription,
|
1052
|
+
fatal: properties.fatal,
|
1053
|
+
...properties.gstCustom,
|
1054
|
+
},
|
1055
|
+
});
|
1056
|
+
}
|
1057
|
+
/**
|
1058
|
+
* User Timings Event in GST.
|
1059
|
+
*
|
1060
|
+
* @param properties Comprised of the mandatory fields:
|
1061
|
+
* - name (string)
|
1062
|
+
* - value (number - integer)
|
1063
|
+
* Properties can also have the optional fields:
|
1064
|
+
* - category (string)
|
1065
|
+
* - label (string)
|
1066
|
+
*
|
1067
|
+
* @link https://developers.google.com/analytics/devguides/collection/gtagjs/user-timings
|
1068
|
+
*/
|
1069
|
+
userTimings(properties) {
|
1070
|
+
if (!properties) {
|
1071
|
+
console.error('User timings - "properties" parameter is required to be set.');
|
1072
|
+
return;
|
1073
|
+
}
|
1074
|
+
this.eventTrackInternal('timing_complete', {
|
1075
|
+
name: properties.name,
|
1076
|
+
value: properties.value,
|
1077
|
+
event_category: properties.category,
|
1078
|
+
event_label: properties.label,
|
1079
|
+
});
|
1080
|
+
}
|
1081
|
+
convertTimings(properties) {
|
1082
|
+
return {
|
1083
|
+
name: properties.timingVar,
|
1084
|
+
value: properties.timingValue,
|
1085
|
+
category: properties.timingCategory,
|
1086
|
+
label: properties.timingLabel,
|
1087
|
+
};
|
1088
|
+
}
|
1089
|
+
setUsername(userId) {
|
1090
|
+
this.angulartics2.settings.gst.userId = userId;
|
1091
|
+
if (typeof gtag !== 'undefined' && gtag) {
|
1092
|
+
gtag('set', { user_id: typeof userId === 'string' || !userId ? userId : userId.userId });
|
1093
|
+
}
|
1094
|
+
}
|
1095
|
+
setUserProperties(properties) {
|
1096
|
+
this.setDimensionsAndMetrics(properties);
|
1097
|
+
}
|
1098
|
+
setDimensionsAndMetrics(properties) {
|
1099
|
+
// We want the dimensions and metrics to accumulate, so we merge with previous value
|
1100
|
+
this.dimensionsAndMetrics = {
|
1101
|
+
...this.dimensionsAndMetrics,
|
1102
|
+
...properties,
|
1103
|
+
};
|
1104
|
+
// Remove properties that are null or undefined
|
1105
|
+
Object.keys(this.dimensionsAndMetrics).forEach(key => {
|
1106
|
+
const val = this.dimensionsAndMetrics[key];
|
1107
|
+
if (val === undefined || val === null) {
|
1108
|
+
delete this.dimensionsAndMetrics[key];
|
1109
|
+
}
|
1110
|
+
});
|
1111
|
+
if (typeof gtag !== 'undefined' && gtag) {
|
1112
|
+
gtag('set', this.dimensionsAndMetrics);
|
1113
|
+
}
|
1114
|
+
}
|
1115
|
+
eventTrackInternal(action, properties = {}) {
|
1116
|
+
this.cleanProperties(properties);
|
1117
|
+
if (typeof gtag !== 'undefined' && gtag) {
|
1118
|
+
gtag('event', action, properties);
|
1119
|
+
}
|
1120
|
+
}
|
1121
|
+
cleanProperties(properties) {
|
1122
|
+
// GA requires that eventValue be an non-negative integer, see:
|
1123
|
+
// https://developers.google.com/analytics/devguides/collection/gtagjs/events
|
1124
|
+
if (properties.value) {
|
1125
|
+
const parsed = parseInt(properties.value, 10);
|
1126
|
+
properties.value = isNaN(parsed) ? 0 : parsed;
|
1127
|
+
}
|
1128
|
+
}
|
1129
|
+
}
|
1130
|
+
Angulartics2GoogleGlobalSiteTag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoogleGlobalSiteTag, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
1131
|
+
Angulartics2GoogleGlobalSiteTag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoogleGlobalSiteTag, providedIn: 'root' });
|
1132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoogleGlobalSiteTag, decorators: [{
|
1133
|
+
type: Injectable,
|
1134
|
+
args: [{ providedIn: 'root' }]
|
1135
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
1136
|
+
|
1137
|
+
class Angulartics2Hubspot {
|
1138
|
+
constructor(angulartics2) {
|
1139
|
+
this.angulartics2 = angulartics2;
|
1140
|
+
this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));
|
1141
|
+
}
|
1142
|
+
startTracking() {
|
1143
|
+
this.angulartics2.pageTrack
|
1144
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1145
|
+
.subscribe(x => this.pageTrack(x.path));
|
1146
|
+
this.angulartics2.eventTrack
|
1147
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1148
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
1149
|
+
}
|
1150
|
+
pageTrack(path) {
|
1151
|
+
if (typeof _hsq !== 'undefined') {
|
1152
|
+
_hsq.push(['setPath', path]);
|
1153
|
+
_hsq.push(['trackPageView']);
|
1154
|
+
}
|
1155
|
+
}
|
1156
|
+
eventTrack(action, properties) {
|
1157
|
+
if (typeof _hsq !== 'undefined') {
|
1158
|
+
_hsq.push(['trackEvent', properties]);
|
1159
|
+
}
|
1160
|
+
}
|
1161
|
+
setUserProperties(properties) {
|
1162
|
+
if (typeof _hsq !== 'undefined') {
|
1163
|
+
_hsq.push(['identify', properties]);
|
1164
|
+
}
|
1165
|
+
}
|
1166
|
+
}
|
1167
|
+
Angulartics2Hubspot.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Hubspot, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
1168
|
+
Angulartics2Hubspot.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Hubspot, providedIn: 'root' });
|
1169
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Hubspot, decorators: [{
|
1170
|
+
type: Injectable,
|
1171
|
+
args: [{ providedIn: 'root' }]
|
1172
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
1173
|
+
|
1174
|
+
class Angulartics2Kissmetrics {
|
1175
|
+
constructor(angulartics2) {
|
1176
|
+
this.angulartics2 = angulartics2;
|
1177
|
+
if (typeof _kmq === 'undefined') {
|
1178
|
+
_kmq = [];
|
1179
|
+
}
|
1180
|
+
this.angulartics2.setUsername.subscribe((x) => this.setUsername(x));
|
1181
|
+
this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));
|
1182
|
+
}
|
1183
|
+
startTracking() {
|
1184
|
+
this.angulartics2.pageTrack
|
1185
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1186
|
+
.subscribe(x => this.pageTrack(x.path));
|
1187
|
+
this.angulartics2.eventTrack
|
1188
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1189
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
1190
|
+
}
|
1191
|
+
pageTrack(path) {
|
1192
|
+
_kmq.push(['record', 'Pageview', { Page: path }]);
|
1193
|
+
}
|
1194
|
+
eventTrack(action, properties) {
|
1195
|
+
_kmq.push(['record', action, properties]);
|
1196
|
+
}
|
1197
|
+
setUsername(userId) {
|
1198
|
+
_kmq.push(['identify', userId]);
|
1199
|
+
}
|
1200
|
+
setUserProperties(properties) {
|
1201
|
+
_kmq.push(['set', properties]);
|
1202
|
+
}
|
1203
|
+
}
|
1204
|
+
Angulartics2Kissmetrics.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Kissmetrics, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
1205
|
+
Angulartics2Kissmetrics.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Kissmetrics, providedIn: 'root' });
|
1206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Kissmetrics, decorators: [{
|
1207
|
+
type: Injectable,
|
1208
|
+
args: [{ providedIn: 'root' }]
|
1209
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
1210
|
+
|
1211
|
+
class Angulartics2LaunchByAdobe {
|
1212
|
+
constructor(angulartics2) {
|
1213
|
+
this.angulartics2 = angulartics2;
|
1214
|
+
this.payload = {};
|
1215
|
+
if ('undefined' === typeof _satellite) {
|
1216
|
+
console.warn('Launch not found!');
|
1217
|
+
}
|
1218
|
+
this.angulartics2.setUsername.subscribe((x) => this.setUsername(x));
|
1219
|
+
this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));
|
1220
|
+
}
|
1221
|
+
setUsername(userId) {
|
1222
|
+
if ('undefined' !== typeof userId && userId) {
|
1223
|
+
this.payload.userId = userId;
|
1224
|
+
}
|
1225
|
+
}
|
1226
|
+
setUserProperties(properties) {
|
1227
|
+
if ('undefined' !== typeof properties && properties) {
|
1228
|
+
this.payload.properties = properties;
|
1229
|
+
}
|
1230
|
+
}
|
1231
|
+
startTracking() {
|
1232
|
+
this.angulartics2.pageTrack
|
1233
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1234
|
+
.subscribe(x => this.pageTrack(x.path));
|
1235
|
+
this.angulartics2.eventTrack
|
1236
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1237
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
1238
|
+
}
|
1239
|
+
pageTrack(path) {
|
1240
|
+
this.payload = this.payload || {};
|
1241
|
+
this.payload.path = path;
|
1242
|
+
if ('undefined' !== typeof _satellite && _satellite) {
|
1243
|
+
_satellite.track('pageTrack', this.payload);
|
1244
|
+
}
|
1245
|
+
}
|
1246
|
+
/**
|
1247
|
+
* @param action associated with the event
|
1248
|
+
* @param properties associated with the event
|
1249
|
+
*/
|
1250
|
+
eventTrack(action, properties) {
|
1251
|
+
properties = properties || {};
|
1252
|
+
// add properties to payload
|
1253
|
+
this.payload.action = action;
|
1254
|
+
this.payload.eventProperties = properties;
|
1255
|
+
if ('undefined' !== typeof _satellite && _satellite) {
|
1256
|
+
_satellite.track('eventTrack', this.payload);
|
1257
|
+
}
|
1258
|
+
}
|
1259
|
+
}
|
1260
|
+
Angulartics2LaunchByAdobe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2LaunchByAdobe, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
1261
|
+
Angulartics2LaunchByAdobe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2LaunchByAdobe, providedIn: 'root' });
|
1262
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2LaunchByAdobe, decorators: [{
|
1263
|
+
type: Injectable,
|
1264
|
+
args: [{ providedIn: 'root' }]
|
1265
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
1266
|
+
|
1267
|
+
class Angulartics2Mixpanel {
|
1268
|
+
constructor(angulartics2) {
|
1269
|
+
this.angulartics2 = angulartics2;
|
1270
|
+
this.angulartics2.setUsername.subscribe((x) => this.setUsername(x));
|
1271
|
+
this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));
|
1272
|
+
this.angulartics2.setUserPropertiesOnce.subscribe(x => this.setUserPropertiesOnce(x));
|
1273
|
+
this.angulartics2.setSuperProperties.subscribe(x => this.setSuperProperties(x));
|
1274
|
+
this.angulartics2.setSuperPropertiesOnce.subscribe(x => this.setSuperPropertiesOnce(x));
|
1275
|
+
this.angulartics2.setAlias.subscribe(x => this.setAlias(x));
|
1276
|
+
}
|
1277
|
+
startTracking() {
|
1278
|
+
this.angulartics2.pageTrack
|
1279
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1280
|
+
.subscribe(x => this.pageTrack(x.path));
|
1281
|
+
this.angulartics2.eventTrack
|
1282
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1283
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
1284
|
+
}
|
1285
|
+
pageTrack(path) {
|
1286
|
+
try {
|
1287
|
+
mixpanel.track('Page Viewed', { page: path });
|
1288
|
+
}
|
1289
|
+
catch (e) {
|
1290
|
+
if (!(e instanceof ReferenceError)) {
|
1291
|
+
throw e;
|
1292
|
+
}
|
1293
|
+
}
|
1294
|
+
}
|
1295
|
+
eventTrack(action, properties) {
|
1296
|
+
try {
|
1297
|
+
mixpanel.track(action, properties);
|
1298
|
+
}
|
1299
|
+
catch (e) {
|
1300
|
+
if (!(e instanceof ReferenceError)) {
|
1301
|
+
throw e;
|
1302
|
+
}
|
1303
|
+
}
|
1304
|
+
}
|
1305
|
+
setUsername(userId) {
|
1306
|
+
try {
|
1307
|
+
mixpanel.identify(userId);
|
1308
|
+
}
|
1309
|
+
catch (e) {
|
1310
|
+
if (!(e instanceof ReferenceError)) {
|
1311
|
+
throw e;
|
1312
|
+
}
|
1313
|
+
}
|
1314
|
+
}
|
1315
|
+
setUserProperties(properties) {
|
1316
|
+
try {
|
1317
|
+
mixpanel.people.set(properties);
|
1318
|
+
}
|
1319
|
+
catch (e) {
|
1320
|
+
if (!(e instanceof ReferenceError)) {
|
1321
|
+
throw e;
|
1322
|
+
}
|
1323
|
+
}
|
1324
|
+
}
|
1325
|
+
setUserPropertiesOnce(properties) {
|
1326
|
+
try {
|
1327
|
+
mixpanel.people.set_once(properties);
|
1328
|
+
}
|
1329
|
+
catch (e) {
|
1330
|
+
if (!(e instanceof ReferenceError)) {
|
1331
|
+
throw e;
|
1332
|
+
}
|
1333
|
+
}
|
1334
|
+
}
|
1335
|
+
setSuperProperties(properties) {
|
1336
|
+
try {
|
1337
|
+
mixpanel.register(properties);
|
1338
|
+
}
|
1339
|
+
catch (e) {
|
1340
|
+
if (!(e instanceof ReferenceError)) {
|
1341
|
+
throw e;
|
1342
|
+
}
|
1343
|
+
}
|
1344
|
+
}
|
1345
|
+
setSuperPropertiesOnce(properties) {
|
1346
|
+
try {
|
1347
|
+
mixpanel.register_once(properties);
|
1348
|
+
}
|
1349
|
+
catch (e) {
|
1350
|
+
if (!(e instanceof ReferenceError)) {
|
1351
|
+
throw e;
|
1352
|
+
}
|
1353
|
+
}
|
1354
|
+
}
|
1355
|
+
setAlias(alias) {
|
1356
|
+
try {
|
1357
|
+
mixpanel.alias(alias);
|
1358
|
+
}
|
1359
|
+
catch (e) {
|
1360
|
+
if (!(e instanceof ReferenceError)) {
|
1361
|
+
throw e;
|
1362
|
+
}
|
1363
|
+
}
|
1364
|
+
}
|
1365
|
+
}
|
1366
|
+
Angulartics2Mixpanel.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Mixpanel, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
1367
|
+
Angulartics2Mixpanel.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Mixpanel, providedIn: 'root' });
|
1368
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Mixpanel, decorators: [{
|
1369
|
+
type: Injectable,
|
1370
|
+
args: [{ providedIn: 'root' }]
|
1371
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
1372
|
+
|
1373
|
+
class Angulartics2Pyze {
|
1374
|
+
constructor(angulartics2) {
|
1375
|
+
this.angulartics2 = angulartics2;
|
1376
|
+
this.angulartics2.setUsername.subscribe((x) => this.setUserId(x));
|
1377
|
+
this.angulartics2.setUserProperties.subscribe(x => this.postTraits(x));
|
1378
|
+
}
|
1379
|
+
startTracking() {
|
1380
|
+
this.angulartics2.pageTrack
|
1381
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1382
|
+
.subscribe(x => this.pageTrack(x.path));
|
1383
|
+
this.angulartics2.eventTrack
|
1384
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1385
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
1386
|
+
}
|
1387
|
+
pageTrack(path) {
|
1388
|
+
try {
|
1389
|
+
Pyze.postPageView('Page Viewed', { page: path });
|
1390
|
+
}
|
1391
|
+
catch (e) {
|
1392
|
+
if (!(e instanceof ReferenceError)) {
|
1393
|
+
throw e;
|
1394
|
+
}
|
1395
|
+
}
|
1396
|
+
}
|
1397
|
+
eventTrack(action, properties) {
|
1398
|
+
try {
|
1399
|
+
PyzeEvents.postCustomEventWithAttributes(action, properties);
|
1400
|
+
}
|
1401
|
+
catch (e) {
|
1402
|
+
if (!(e instanceof ReferenceError)) {
|
1403
|
+
throw e;
|
1404
|
+
}
|
1405
|
+
}
|
1406
|
+
}
|
1407
|
+
setUserId(userId) {
|
1408
|
+
try {
|
1409
|
+
PyzeIdentity.setUserIdentifier(userId);
|
1410
|
+
}
|
1411
|
+
catch (e) {
|
1412
|
+
if (!(e instanceof ReferenceError)) {
|
1413
|
+
throw e;
|
1414
|
+
}
|
1415
|
+
}
|
1416
|
+
}
|
1417
|
+
postTraits(properties) {
|
1418
|
+
try {
|
1419
|
+
PyzeIdentity.postTraits(properties);
|
1420
|
+
}
|
1421
|
+
catch (e) {
|
1422
|
+
if (!(e instanceof ReferenceError)) {
|
1423
|
+
throw e;
|
1424
|
+
}
|
1425
|
+
}
|
1426
|
+
}
|
1427
|
+
}
|
1428
|
+
Angulartics2Pyze.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Pyze, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
1429
|
+
Angulartics2Pyze.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Pyze, providedIn: 'root' });
|
1430
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Pyze, decorators: [{
|
1431
|
+
type: Injectable,
|
1432
|
+
args: [{ providedIn: 'root' }]
|
1433
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
1434
|
+
|
1435
|
+
class Angulartics2Matomo {
|
1436
|
+
constructor(angulartics2) {
|
1437
|
+
this.angulartics2 = angulartics2;
|
1438
|
+
if (typeof _paq === 'undefined') {
|
1439
|
+
console.warn('Matomo not found');
|
1440
|
+
}
|
1441
|
+
this.angulartics2.setUsername.subscribe((x) => this.setUsername(x));
|
1442
|
+
this.angulartics2.setUserProperties.subscribe((x) => this.setUserProperties(x));
|
1443
|
+
}
|
1444
|
+
startTracking() {
|
1445
|
+
this.angulartics2.pageTrack
|
1446
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1447
|
+
.subscribe(x => this.pageTrack(x.path));
|
1448
|
+
this.angulartics2.eventTrack
|
1449
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1450
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
1451
|
+
}
|
1452
|
+
pageTrack(path, title) {
|
1453
|
+
try {
|
1454
|
+
if (!window.location.origin) {
|
1455
|
+
window.location.origin =
|
1456
|
+
window.location.protocol +
|
1457
|
+
'//' +
|
1458
|
+
window.location.hostname +
|
1459
|
+
(window.location.port ? ':' + window.location.port : '');
|
1460
|
+
}
|
1461
|
+
_paq.push(['setDocumentTitle', title || window.document.title]);
|
1462
|
+
_paq.push(['setCustomUrl', window.location.origin + path]);
|
1463
|
+
_paq.push(['trackPageView']);
|
1464
|
+
}
|
1465
|
+
catch (e) {
|
1466
|
+
if (!(e instanceof ReferenceError)) {
|
1467
|
+
throw e;
|
1468
|
+
}
|
1469
|
+
}
|
1470
|
+
}
|
1471
|
+
resetUser() {
|
1472
|
+
try {
|
1473
|
+
_paq.push(['appendToTrackingUrl', 'new_visit=1']); // (1) forces a new visit
|
1474
|
+
_paq.push(['deleteCookies']); // (2) deletes existing tracking cookies to start the new visit
|
1475
|
+
}
|
1476
|
+
catch (e) {
|
1477
|
+
if (!(e instanceof ReferenceError)) {
|
1478
|
+
throw e;
|
1479
|
+
}
|
1480
|
+
}
|
1481
|
+
}
|
1482
|
+
/**
|
1483
|
+
* Track a basic event in Matomo, or send an ecommerce event.
|
1484
|
+
*
|
1485
|
+
* @param action A string corresponding to the type of event that needs to be tracked.
|
1486
|
+
* @param properties The properties that need to be logged with the event.
|
1487
|
+
*/
|
1488
|
+
eventTrack(action, properties) {
|
1489
|
+
let params = [];
|
1490
|
+
switch (action) {
|
1491
|
+
/**
|
1492
|
+
* @description Sets the current page view as a product or category page view. When you call
|
1493
|
+
* setEcommerceView it must be followed by a call to trackPageView to record the product or
|
1494
|
+
* category page view.
|
1495
|
+
*
|
1496
|
+
* @link https://matomo.org/docs/ecommerce-analytics/#tracking-product-page-views-category-page-views-optional
|
1497
|
+
* @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce
|
1498
|
+
*
|
1499
|
+
* @property productSKU (required) SKU: Product unique identifier
|
1500
|
+
* @property productName (optional) Product name
|
1501
|
+
* @property categoryName (optional) Product category, or array of up to 5 categories
|
1502
|
+
* @property price (optional) Product Price as displayed on the page
|
1503
|
+
*/
|
1504
|
+
case 'setEcommerceView':
|
1505
|
+
params = [
|
1506
|
+
'setEcommerceView',
|
1507
|
+
properties.productSKU,
|
1508
|
+
properties.productName,
|
1509
|
+
properties.categoryName,
|
1510
|
+
properties.price,
|
1511
|
+
];
|
1512
|
+
break;
|
1513
|
+
/**
|
1514
|
+
* @description Adds a product into the ecommerce order. Must be called for each product in
|
1515
|
+
* the order.
|
1516
|
+
*
|
1517
|
+
* @link https://matomo.org/docs/ecommerce-analytics/#tracking-ecommerce-orders-items-purchased-required
|
1518
|
+
* @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce
|
1519
|
+
*
|
1520
|
+
* @property productSKU (required) SKU: Product unique identifier
|
1521
|
+
* @property productName (optional) Product name
|
1522
|
+
* @property categoryName (optional) Product category, or array of up to 5 categories
|
1523
|
+
* @property price (recommended) Product price
|
1524
|
+
* @property quantity (optional, default to 1) Product quantity
|
1525
|
+
*/
|
1526
|
+
case 'addEcommerceItem':
|
1527
|
+
params = [
|
1528
|
+
'addEcommerceItem',
|
1529
|
+
properties.productSKU,
|
1530
|
+
properties.productName,
|
1531
|
+
properties.productCategory,
|
1532
|
+
properties.price,
|
1533
|
+
properties.quantity,
|
1534
|
+
];
|
1535
|
+
break;
|
1536
|
+
/**
|
1537
|
+
* @description Tracks a shopping cart. Call this javascript function every time a user is
|
1538
|
+
* adding, updating or deleting a product from the cart.
|
1539
|
+
*
|
1540
|
+
* @link https://matomo.org/docs/ecommerce-analytics/#tracking-add-to-cart-items-added-to-the-cart-optional
|
1541
|
+
* @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce
|
1542
|
+
*
|
1543
|
+
* @property grandTotal (required) Cart amount
|
1544
|
+
*/
|
1545
|
+
case 'trackEcommerceCartUpdate':
|
1546
|
+
params = [
|
1547
|
+
'trackEcommerceCartUpdate',
|
1548
|
+
properties.grandTotal,
|
1549
|
+
];
|
1550
|
+
break;
|
1551
|
+
/**
|
1552
|
+
* @description Tracks an Ecommerce order, including any ecommerce item previously added to
|
1553
|
+
* the order. orderId and grandTotal (ie. revenue) are required parameters.
|
1554
|
+
*
|
1555
|
+
* @link https://matomo.org/docs/ecommerce-analytics/#tracking-ecommerce-orders-items-purchased-required
|
1556
|
+
* @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce
|
1557
|
+
*
|
1558
|
+
* @property orderId (required) Unique Order ID
|
1559
|
+
* @property grandTotal (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)
|
1560
|
+
* @property subTotal (optional) Order sub total (excludes shipping)
|
1561
|
+
* @property tax (optional) Tax amount
|
1562
|
+
* @property shipping (optional) Shipping amount
|
1563
|
+
* @property discount (optional) Discount offered (set to false for unspecified parameter)
|
1564
|
+
*/
|
1565
|
+
case 'trackEcommerceOrder':
|
1566
|
+
params = [
|
1567
|
+
'trackEcommerceOrder',
|
1568
|
+
properties.orderId,
|
1569
|
+
properties.grandTotal,
|
1570
|
+
properties.subTotal,
|
1571
|
+
properties.tax,
|
1572
|
+
properties.shipping,
|
1573
|
+
properties.discount,
|
1574
|
+
];
|
1575
|
+
break;
|
1576
|
+
/**
|
1577
|
+
* @description To manually trigger an outlink
|
1578
|
+
*
|
1579
|
+
* @link https://matomo.org/docs/tracking-goals-web-analytics/
|
1580
|
+
* @link https://developer.matomo.org/guides/tracking-javascript-guide#tracking-a-click-as-an-outlink-via-css-or-javascript
|
1581
|
+
*
|
1582
|
+
* @property url (required) link url
|
1583
|
+
* @property linkType (optional) type of link
|
1584
|
+
*/
|
1585
|
+
case 'trackLink':
|
1586
|
+
params = [
|
1587
|
+
'trackLink',
|
1588
|
+
properties.url,
|
1589
|
+
properties.linkType,
|
1590
|
+
];
|
1591
|
+
break;
|
1592
|
+
/**
|
1593
|
+
* @description Tracks an Ecommerce goal
|
1594
|
+
*
|
1595
|
+
* @link https://matomo.org/docs/tracking-goals-web-analytics/
|
1596
|
+
* @link https://developer.matomo.org/guides/tracking-javascript-guide#manually-trigger-goal-conversions
|
1597
|
+
*
|
1598
|
+
* @property goalId (required) Unique Goal ID
|
1599
|
+
* @property value (optional) passed to goal tracking
|
1600
|
+
*/
|
1601
|
+
case 'trackGoal':
|
1602
|
+
params = [
|
1603
|
+
'trackGoal',
|
1604
|
+
properties.goalId,
|
1605
|
+
properties.value,
|
1606
|
+
];
|
1607
|
+
break;
|
1608
|
+
/**
|
1609
|
+
* @description Tracks a site search
|
1610
|
+
*
|
1611
|
+
* @link https://matomo.org/docs/site-search/
|
1612
|
+
* @link https://developer.matomo.org/guides/tracking-javascript-guide#internal-search-tracking
|
1613
|
+
*
|
1614
|
+
* @property keyword (required) Keyword searched for
|
1615
|
+
* @property category (optional) Search category
|
1616
|
+
* @property searchCount (optional) Number of results
|
1617
|
+
*/
|
1618
|
+
case 'trackSiteSearch':
|
1619
|
+
params = [
|
1620
|
+
'trackSiteSearch',
|
1621
|
+
properties.keyword,
|
1622
|
+
properties.category,
|
1623
|
+
properties.searchCount,
|
1624
|
+
];
|
1625
|
+
break;
|
1626
|
+
/**
|
1627
|
+
* @description Logs an event with an event category (Videos, Music, Games...), an event
|
1628
|
+
* action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...), and an optional
|
1629
|
+
* event name and optional numeric value.
|
1630
|
+
*
|
1631
|
+
* @link https://matomo.org/docs/event-tracking/
|
1632
|
+
* @link https://developer.matomo.org/api-reference/tracking-javascript#using-the-tracker-object
|
1633
|
+
*
|
1634
|
+
* @property category
|
1635
|
+
* @property action
|
1636
|
+
* @property name (optional, recommended)
|
1637
|
+
* @property value (optional)
|
1638
|
+
*/
|
1639
|
+
default:
|
1640
|
+
// PAQ requires that eventValue be an integer, see: http://matomo.org/docs/event-tracking
|
1641
|
+
if (properties.value) {
|
1642
|
+
const parsed = parseInt(properties.value, 10);
|
1643
|
+
properties.value = isNaN(parsed) ? 0 : parsed;
|
1644
|
+
}
|
1645
|
+
params = [
|
1646
|
+
'trackEvent',
|
1647
|
+
properties.category,
|
1648
|
+
action,
|
1649
|
+
properties.name ||
|
1650
|
+
properties.label,
|
1651
|
+
properties.value,
|
1652
|
+
];
|
1653
|
+
}
|
1654
|
+
try {
|
1655
|
+
_paq.push(params);
|
1656
|
+
}
|
1657
|
+
catch (e) {
|
1658
|
+
if (!(e instanceof ReferenceError)) {
|
1659
|
+
throw e;
|
1660
|
+
}
|
1661
|
+
}
|
1662
|
+
}
|
1663
|
+
setUsername(userId) {
|
1664
|
+
try {
|
1665
|
+
_paq.push(['setUserId', userId]);
|
1666
|
+
}
|
1667
|
+
catch (e) {
|
1668
|
+
if (!(e instanceof ReferenceError)) {
|
1669
|
+
throw e;
|
1670
|
+
}
|
1671
|
+
}
|
1672
|
+
}
|
1673
|
+
/**
|
1674
|
+
* Sets custom dimensions if at least one property has the key "dimension<n>",
|
1675
|
+
* e.g. dimension10. If there are custom dimensions, any other property is ignored.
|
1676
|
+
*
|
1677
|
+
* If there are no custom dimensions in the given properties object, the properties
|
1678
|
+
* object is saved as a custom variable.
|
1679
|
+
*
|
1680
|
+
* If in doubt, prefer custom dimensions.
|
1681
|
+
* @link https://matomo.org/docs/custom-variables/
|
1682
|
+
*/
|
1683
|
+
setUserProperties(properties) {
|
1684
|
+
const dimensions = this.setCustomDimensions(properties);
|
1685
|
+
try {
|
1686
|
+
if (dimensions.length === 0) {
|
1687
|
+
_paq.push([
|
1688
|
+
'setCustomVariable',
|
1689
|
+
properties.index,
|
1690
|
+
properties.name,
|
1691
|
+
properties.value,
|
1692
|
+
properties.scope,
|
1693
|
+
]);
|
1694
|
+
}
|
1695
|
+
}
|
1696
|
+
catch (e) {
|
1697
|
+
if (!(e instanceof ReferenceError)) {
|
1698
|
+
throw e;
|
1699
|
+
}
|
1700
|
+
}
|
1701
|
+
}
|
1702
|
+
/**
|
1703
|
+
* If you created a custom variable and then decide to remove this variable from
|
1704
|
+
* a visit or page view, you can use deleteCustomVariable.
|
1705
|
+
*
|
1706
|
+
* @link https://developer.matomo.org/guides/tracking-javascript-guide#deleting-a-custom-variable
|
1707
|
+
*/
|
1708
|
+
deletedUserProperties(properties) {
|
1709
|
+
try {
|
1710
|
+
_paq.push(['deleteCustomVariable', properties.index, properties.scope]);
|
1711
|
+
}
|
1712
|
+
catch (e) {
|
1713
|
+
if (!(e instanceof ReferenceError)) {
|
1714
|
+
throw e;
|
1715
|
+
}
|
1716
|
+
}
|
1717
|
+
}
|
1718
|
+
setCustomDimensions(properties) {
|
1719
|
+
const dimensionRegex = /dimension[1-9]\d*/;
|
1720
|
+
const dimensions = Object.keys(properties).filter(key => dimensionRegex.exec(key));
|
1721
|
+
dimensions.forEach(dimension => {
|
1722
|
+
const number = Number(dimension.substr(9));
|
1723
|
+
_paq.push(['setCustomDimension', number, properties[dimension]]);
|
1724
|
+
});
|
1725
|
+
return dimensions;
|
1726
|
+
}
|
1727
|
+
}
|
1728
|
+
Angulartics2Matomo.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Matomo, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
1729
|
+
Angulartics2Matomo.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Matomo, providedIn: 'root' });
|
1730
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Matomo, decorators: [{
|
1731
|
+
type: Injectable,
|
1732
|
+
args: [{ providedIn: 'root' }]
|
1733
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
1734
|
+
|
1735
|
+
class Angulartics2Segment {
|
1736
|
+
constructor(angulartics2) {
|
1737
|
+
this.angulartics2 = angulartics2;
|
1738
|
+
this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));
|
1739
|
+
this.angulartics2.setUserPropertiesOnce.subscribe(x => this.setUserProperties(x));
|
1740
|
+
this.angulartics2.setAlias.subscribe(x => this.setAlias(x));
|
1741
|
+
}
|
1742
|
+
startTracking() {
|
1743
|
+
this.angulartics2.pageTrack
|
1744
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1745
|
+
.subscribe(x => this.pageTrack(x.path));
|
1746
|
+
this.angulartics2.eventTrack
|
1747
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1748
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
1749
|
+
}
|
1750
|
+
/**
|
1751
|
+
* https://segment.com/docs/libraries/analytics.js/#page
|
1752
|
+
*
|
1753
|
+
* analytics.page([category], [name], [properties], [options], [callback]);
|
1754
|
+
*/
|
1755
|
+
pageTrack(path) {
|
1756
|
+
// TODO : Support optional parameters where the parameter order and type changes their meaning
|
1757
|
+
try {
|
1758
|
+
analytics.page(path);
|
1759
|
+
}
|
1760
|
+
catch (e) {
|
1761
|
+
if (!(e instanceof ReferenceError)) {
|
1762
|
+
throw e;
|
1763
|
+
}
|
1764
|
+
}
|
1765
|
+
}
|
1766
|
+
/**
|
1767
|
+
* https://segment.com/docs/libraries/analytics.js/#track
|
1768
|
+
*
|
1769
|
+
* analytics.track(event, [properties], [options], [callback]);
|
1770
|
+
*/
|
1771
|
+
eventTrack(action, properties) {
|
1772
|
+
try {
|
1773
|
+
analytics.track(action, properties);
|
1774
|
+
}
|
1775
|
+
catch (e) {
|
1776
|
+
if (!(e instanceof ReferenceError)) {
|
1777
|
+
throw e;
|
1778
|
+
}
|
1779
|
+
}
|
1780
|
+
}
|
1781
|
+
/**
|
1782
|
+
* https://segment.com/docs/libraries/analytics.js/#identify
|
1783
|
+
*
|
1784
|
+
* analytics.identify([userId], [traits], [options], [callback]);
|
1785
|
+
*/
|
1786
|
+
setUserProperties(properties) {
|
1787
|
+
try {
|
1788
|
+
if (properties.userId) {
|
1789
|
+
analytics.identify(properties.userId, properties);
|
1790
|
+
}
|
1791
|
+
else {
|
1792
|
+
analytics.identify(properties);
|
1793
|
+
}
|
1794
|
+
}
|
1795
|
+
catch (e) {
|
1796
|
+
if (!(e instanceof ReferenceError)) {
|
1797
|
+
throw e;
|
1798
|
+
}
|
1799
|
+
}
|
1800
|
+
}
|
1801
|
+
/**
|
1802
|
+
* https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#reset--logout
|
1803
|
+
*
|
1804
|
+
* analytics.reset();
|
1805
|
+
*/
|
1806
|
+
unsetUserProperties() {
|
1807
|
+
analytics.reset();
|
1808
|
+
}
|
1809
|
+
/**
|
1810
|
+
* https://segment.com/docs/libraries/analytics.js/#alias
|
1811
|
+
*
|
1812
|
+
* analytics.alias(userId, previousId, options, callback);
|
1813
|
+
*/
|
1814
|
+
setAlias(alias) {
|
1815
|
+
try {
|
1816
|
+
analytics.alias(alias);
|
1817
|
+
}
|
1818
|
+
catch (e) {
|
1819
|
+
if (!(e instanceof ReferenceError)) {
|
1820
|
+
throw e;
|
1821
|
+
}
|
1822
|
+
}
|
1823
|
+
}
|
1824
|
+
}
|
1825
|
+
Angulartics2Segment.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Segment, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
1826
|
+
Angulartics2Segment.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Segment, providedIn: 'root' });
|
1827
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Segment, decorators: [{
|
1828
|
+
type: Injectable,
|
1829
|
+
args: [{ providedIn: 'root' }]
|
1830
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
1831
|
+
|
1832
|
+
class Angulartics2Intercom {
|
1833
|
+
constructor(angulartics2) {
|
1834
|
+
this.angulartics2 = angulartics2;
|
1835
|
+
this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));
|
1836
|
+
this.angulartics2.setUserPropertiesOnce.subscribe(x => this.setUserProperties(x));
|
1837
|
+
}
|
1838
|
+
startTracking() {
|
1839
|
+
this.angulartics2.pageTrack
|
1840
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1841
|
+
.subscribe(x => this.pageTrack(x.path));
|
1842
|
+
this.angulartics2.eventTrack
|
1843
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1844
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
1845
|
+
}
|
1846
|
+
pageTrack(path) {
|
1847
|
+
try {
|
1848
|
+
this.eventTrack('Pageview', {
|
1849
|
+
url: path,
|
1850
|
+
});
|
1851
|
+
}
|
1852
|
+
catch (e) {
|
1853
|
+
if (!(e instanceof ReferenceError)) {
|
1854
|
+
throw e;
|
1855
|
+
}
|
1856
|
+
}
|
1857
|
+
}
|
1858
|
+
eventTrack(action, properties) {
|
1859
|
+
try {
|
1860
|
+
Intercom('trackEvent', action, properties);
|
1861
|
+
}
|
1862
|
+
catch (e) {
|
1863
|
+
if (!(e instanceof ReferenceError)) {
|
1864
|
+
throw e;
|
1865
|
+
}
|
1866
|
+
}
|
1867
|
+
}
|
1868
|
+
setUserProperties(properties) {
|
1869
|
+
try {
|
1870
|
+
if (properties.userId && !properties.user_id) {
|
1871
|
+
properties.user_id = properties.userId;
|
1872
|
+
}
|
1873
|
+
Intercom('boot', properties);
|
1874
|
+
}
|
1875
|
+
catch (e) {
|
1876
|
+
if (!(e instanceof ReferenceError)) {
|
1877
|
+
throw e;
|
1878
|
+
}
|
1879
|
+
}
|
1880
|
+
}
|
1881
|
+
}
|
1882
|
+
Angulartics2Intercom.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Intercom, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
1883
|
+
Angulartics2Intercom.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Intercom, providedIn: 'root' });
|
1884
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Intercom, decorators: [{
|
1885
|
+
type: Injectable,
|
1886
|
+
args: [{ providedIn: 'root' }]
|
1887
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
1888
|
+
|
1889
|
+
class Angulartics2Woopra {
|
1890
|
+
constructor(angulartics2) {
|
1891
|
+
this.angulartics2 = angulartics2;
|
1892
|
+
if (typeof woopra === 'undefined') {
|
1893
|
+
console.warn('Woopra not found');
|
1894
|
+
}
|
1895
|
+
this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));
|
1896
|
+
}
|
1897
|
+
startTracking() {
|
1898
|
+
this.angulartics2.pageTrack
|
1899
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1900
|
+
.subscribe(x => this.pageTrack(x.path));
|
1901
|
+
this.angulartics2.eventTrack
|
1902
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1903
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
1904
|
+
}
|
1905
|
+
pageTrack(path) {
|
1906
|
+
try {
|
1907
|
+
woopra.track('pv', {
|
1908
|
+
url: path,
|
1909
|
+
});
|
1910
|
+
}
|
1911
|
+
catch (e) {
|
1912
|
+
if (!(e instanceof ReferenceError)) {
|
1913
|
+
throw e;
|
1914
|
+
}
|
1915
|
+
}
|
1916
|
+
}
|
1917
|
+
eventTrack(action, properties) {
|
1918
|
+
try {
|
1919
|
+
woopra.track(action, properties);
|
1920
|
+
}
|
1921
|
+
catch (e) {
|
1922
|
+
if (!(e instanceof ReferenceError)) {
|
1923
|
+
throw e;
|
1924
|
+
}
|
1925
|
+
}
|
1926
|
+
}
|
1927
|
+
setUserProperties(properties) {
|
1928
|
+
try {
|
1929
|
+
if (properties.email) {
|
1930
|
+
woopra.identify(properties);
|
1931
|
+
}
|
1932
|
+
}
|
1933
|
+
catch (e) {
|
1934
|
+
if (!(e instanceof ReferenceError)) {
|
1935
|
+
throw e;
|
1936
|
+
}
|
1937
|
+
}
|
1938
|
+
}
|
1939
|
+
}
|
1940
|
+
Angulartics2Woopra.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Woopra, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
1941
|
+
Angulartics2Woopra.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Woopra, providedIn: 'root' });
|
1942
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Woopra, decorators: [{
|
1943
|
+
type: Injectable,
|
1944
|
+
args: [{ providedIn: 'root' }]
|
1945
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
1946
|
+
|
1947
|
+
class Angulartics2Clicky {
|
1948
|
+
constructor(angulartics2, titleService) {
|
1949
|
+
this.angulartics2 = angulartics2;
|
1950
|
+
this.titleService = titleService;
|
1951
|
+
if (typeof clicky === 'undefined') {
|
1952
|
+
console.warn('Angulartics 2 Clicky Plugin: clicky global not found');
|
1953
|
+
}
|
1954
|
+
}
|
1955
|
+
startTracking() {
|
1956
|
+
this.angulartics2.pageTrack
|
1957
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1958
|
+
.subscribe(x => this.pageTrack(x.path));
|
1959
|
+
this.angulartics2.eventTrack
|
1960
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
1961
|
+
.subscribe(x => this.eventOrGoalTrack(x.action, x.properties));
|
1962
|
+
}
|
1963
|
+
/**
|
1964
|
+
* Track Page in Clicky
|
1965
|
+
*
|
1966
|
+
* @param path location
|
1967
|
+
*
|
1968
|
+
* @link https://clicky.com/help/custom/manual#log
|
1969
|
+
*/
|
1970
|
+
pageTrack(path) {
|
1971
|
+
const title = this.titleService.getTitle();
|
1972
|
+
clicky.log(path, title, 'pageview');
|
1973
|
+
}
|
1974
|
+
/**
|
1975
|
+
* Track Event Or Goal in Clicky
|
1976
|
+
*
|
1977
|
+
* @param action Action name
|
1978
|
+
* @param properties Definition of 'properties.goal' determines goal vs event tracking
|
1979
|
+
*
|
1980
|
+
* @link https://clicky.com/help/custom/manual#log
|
1981
|
+
* @link https://clicky.com/help/custom/manual#goal
|
1982
|
+
*/
|
1983
|
+
eventOrGoalTrack(action, properties) {
|
1984
|
+
if (typeof properties.goal === 'undefined') {
|
1985
|
+
const title = properties.title || null;
|
1986
|
+
const type = properties.type != null ? this.validateType(properties.type) : null;
|
1987
|
+
clicky.log(action, title, type);
|
1988
|
+
}
|
1989
|
+
else {
|
1990
|
+
const goalId = properties.goal;
|
1991
|
+
const revenue = properties.revenue;
|
1992
|
+
clicky.goal(goalId, revenue, !!properties.noQueue);
|
1993
|
+
}
|
1994
|
+
}
|
1995
|
+
validateType(type) {
|
1996
|
+
const EventType = ['pageview', 'click', 'download', 'outbound'];
|
1997
|
+
return EventType.indexOf(type) > -1 ? type : 'pageview';
|
1998
|
+
}
|
1999
|
+
}
|
2000
|
+
Angulartics2Clicky.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Clicky, deps: [{ token: Angulartics2 }, { token: i2$1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
|
2001
|
+
Angulartics2Clicky.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Clicky, providedIn: 'root' });
|
2002
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Clicky, decorators: [{
|
2003
|
+
type: Injectable,
|
2004
|
+
args: [{ providedIn: 'root' }]
|
2005
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }, { type: i2$1.Title }]; } });
|
2006
|
+
|
2007
|
+
class Angulartics2Amplitude {
|
2008
|
+
constructor(angulartics2) {
|
2009
|
+
this.angulartics2 = angulartics2;
|
2010
|
+
this.angulartics2.setUsername.subscribe((x) => this.setUsername(x));
|
2011
|
+
this.angulartics2.setUserProperties.subscribe((x) => this.setUserProperties(x));
|
2012
|
+
this.angulartics2.setUserPropertiesOnce.subscribe((x) => this.setUserProperties(x));
|
2013
|
+
}
|
2014
|
+
startTracking() {
|
2015
|
+
this.angulartics2.pageTrack
|
2016
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
2017
|
+
.subscribe((x) => this.pageTrack(x.path));
|
2018
|
+
this.angulartics2.eventTrack
|
2019
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
2020
|
+
.subscribe((x) => this.eventTrack(x.action, x.properties));
|
2021
|
+
}
|
2022
|
+
pageTrack(path) {
|
2023
|
+
try {
|
2024
|
+
this.eventTrack('Pageview', {
|
2025
|
+
url: path,
|
2026
|
+
});
|
2027
|
+
}
|
2028
|
+
catch (e) {
|
2029
|
+
if (!(e instanceof ReferenceError)) {
|
2030
|
+
throw e;
|
2031
|
+
}
|
2032
|
+
}
|
2033
|
+
}
|
2034
|
+
eventTrack(action, properties) {
|
2035
|
+
try {
|
2036
|
+
amplitude.getInstance().logEvent(action, properties);
|
2037
|
+
}
|
2038
|
+
catch (e) {
|
2039
|
+
if (!(e instanceof ReferenceError)) {
|
2040
|
+
throw e;
|
2041
|
+
}
|
2042
|
+
}
|
2043
|
+
}
|
2044
|
+
setUsername(userId) {
|
2045
|
+
try {
|
2046
|
+
amplitude.getInstance().setUserId(userId);
|
2047
|
+
}
|
2048
|
+
catch (e) {
|
2049
|
+
if (!(e instanceof ReferenceError)) {
|
2050
|
+
throw e;
|
2051
|
+
}
|
2052
|
+
}
|
2053
|
+
}
|
2054
|
+
setUserProperties(properties) {
|
2055
|
+
try {
|
2056
|
+
amplitude.getInstance().setUserProperties(properties);
|
2057
|
+
}
|
2058
|
+
catch (e) {
|
2059
|
+
if (!(e instanceof ReferenceError)) {
|
2060
|
+
throw e;
|
2061
|
+
}
|
2062
|
+
}
|
2063
|
+
}
|
2064
|
+
}
|
2065
|
+
Angulartics2Amplitude.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Amplitude, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
2066
|
+
Angulartics2Amplitude.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Amplitude, providedIn: 'root' });
|
2067
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Amplitude, decorators: [{
|
2068
|
+
type: Injectable,
|
2069
|
+
args: [{ providedIn: 'root' }]
|
2070
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
2071
|
+
|
2072
|
+
class Angulartics2Splunk {
|
2073
|
+
constructor(angulartics2) {
|
2074
|
+
this.angulartics2 = angulartics2;
|
2075
|
+
if (typeof sp === 'undefined') {
|
2076
|
+
console.warn('Splunk not found');
|
2077
|
+
}
|
2078
|
+
}
|
2079
|
+
startTracking() {
|
2080
|
+
this.angulartics2.pageTrack
|
2081
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
2082
|
+
.subscribe(x => this.pageTrack(x.path));
|
2083
|
+
this.angulartics2.eventTrack
|
2084
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
2085
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
2086
|
+
}
|
2087
|
+
pageTrack(path) {
|
2088
|
+
try {
|
2089
|
+
sp.pageview(path);
|
2090
|
+
}
|
2091
|
+
catch (e) {
|
2092
|
+
if (!(e instanceof ReferenceError)) {
|
2093
|
+
throw e;
|
2094
|
+
}
|
2095
|
+
}
|
2096
|
+
}
|
2097
|
+
eventTrack(action, properties) {
|
2098
|
+
try {
|
2099
|
+
sp.track(action, properties);
|
2100
|
+
}
|
2101
|
+
catch (e) {
|
2102
|
+
if (!(e instanceof ReferenceError)) {
|
2103
|
+
throw e;
|
2104
|
+
}
|
2105
|
+
}
|
2106
|
+
}
|
2107
|
+
}
|
2108
|
+
Angulartics2Splunk.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Splunk, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
2109
|
+
Angulartics2Splunk.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Splunk, providedIn: 'root' });
|
2110
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2Splunk, decorators: [{
|
2111
|
+
type: Injectable,
|
2112
|
+
args: [{ providedIn: 'root' }]
|
2113
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
2114
|
+
|
2115
|
+
class Angulartics2IBMDigitalAnalytics {
|
2116
|
+
constructor(angulartics2) {
|
2117
|
+
this.angulartics2 = angulartics2;
|
2118
|
+
if (typeof window['cmCreatePageviewTag'] !== 'function') {
|
2119
|
+
console.warn('Angulartics 2 IBM Digital Analytics Plugin: eluminate.js is not loaded');
|
2120
|
+
}
|
2121
|
+
}
|
2122
|
+
startTracking() {
|
2123
|
+
this.angulartics2.pageTrack
|
2124
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
2125
|
+
.subscribe(x => this.pageTrack(x.path));
|
2126
|
+
this.angulartics2.eventTrack
|
2127
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
2128
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
2129
|
+
}
|
2130
|
+
/**
|
2131
|
+
* Track Page in IBM Digital Analytics
|
2132
|
+
*
|
2133
|
+
* @param path location
|
2134
|
+
*
|
2135
|
+
* @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_pageviewtag.html
|
2136
|
+
*/
|
2137
|
+
pageTrack(path) {
|
2138
|
+
const cmCreatePageviewTag = window['cmCreatePageviewTag'];
|
2139
|
+
cmCreatePageviewTag(path, null, null, null);
|
2140
|
+
}
|
2141
|
+
/**
|
2142
|
+
* Track an event in IBM Digital Analytics
|
2143
|
+
*
|
2144
|
+
* @param action A string corresponding to the type of event that needs to be tracked.
|
2145
|
+
* @param properties The properties that need to be logged with the event.
|
2146
|
+
*/
|
2147
|
+
eventTrack(action, properties = {}) {
|
2148
|
+
const cmDisplayShops = window['cmDisplayShops'];
|
2149
|
+
switch (action) {
|
2150
|
+
/**
|
2151
|
+
* @description The Product View tag captures information about vdigitalDataiews of product detail pages.
|
2152
|
+
* The Product View tag should be called on the lowest level detail page for products, which is typically
|
2153
|
+
* the Product Details page. You can view example Product View tags below.
|
2154
|
+
*
|
2155
|
+
* @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_prodviewtag.html
|
2156
|
+
*/
|
2157
|
+
case 'cmCreateProductviewTag':
|
2158
|
+
const cmCreateProductviewTag = window['cmCreateProductviewTag'];
|
2159
|
+
cmCreateProductviewTag(properties.productId, properties.productName, properties.categoryId, properties.attrbute, properties.virtualCategory);
|
2160
|
+
break;
|
2161
|
+
/**
|
2162
|
+
* @description The Shop Action 5 tag captures data about selected products and which products are present in a shopping cart,
|
2163
|
+
* if any, when the cart is viewed.
|
2164
|
+
*
|
2165
|
+
* @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_shopact5tag.html
|
2166
|
+
*/
|
2167
|
+
case 'cmCreateShopAction5Tag':
|
2168
|
+
const cmCreateShopAction5Tag = window['cmCreateShopAction5Tag'];
|
2169
|
+
cmCreateShopAction5Tag(properties.productId, properties.productName, properties.quantity, properties.unitPrice, properties.categoryId, properties.attrbute, properties.extraFields, properties.virtualCategory);
|
2170
|
+
cmDisplayShops();
|
2171
|
+
break;
|
2172
|
+
/**
|
2173
|
+
* @description The Shop Action 9 tag captures data about what products were purchased by a customer.
|
2174
|
+
* Like the Shop Action 5 tag, one tag should be sent for each product line item purchased. These tags should be sent
|
2175
|
+
* on the receipt or other completion page confirming a successful order.
|
2176
|
+
*
|
2177
|
+
* @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_shopact9tag.html
|
2178
|
+
*/
|
2179
|
+
case 'cmCreateShopAction9Tag':
|
2180
|
+
const cmCreateShopAction9Tag = window['cmCreateShopAction9Tag'];
|
2181
|
+
cmCreateShopAction9Tag(properties.productId, properties.productName, properties.quantity, properties.unitPrice, properties.registrationId, properties.orderId, properties.orderSubtotal, properties.categoryId, properties.attrbute, properties.extraFields);
|
2182
|
+
cmDisplayShops();
|
2183
|
+
break;
|
2184
|
+
/**
|
2185
|
+
* @description The Order tag captures order header information such as Registration ID, order ID, order subtotal,
|
2186
|
+
* and shipping and handling. The Order tag should be sent on the receipt page confirming order completion.
|
2187
|
+
*
|
2188
|
+
* @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_ordertag.html
|
2189
|
+
*/
|
2190
|
+
case 'cmCreateOrderTag':
|
2191
|
+
const cmCreateOrderTag = window['cmCreateOrderTag'];
|
2192
|
+
cmCreateOrderTag(properties.orderId, properties.orderSubtotal, properties.orderShipping, properties.registrationId, properties.registrantCity, properties.registrantState, properties.registrantPostalCode, properties.attrbute, properties.extraFields);
|
2193
|
+
break;
|
2194
|
+
/**
|
2195
|
+
* @description The Registration tag creates a Lifetime Visitor Experience Profile (LIVE Profile) by associating a single
|
2196
|
+
* common Registration ID with the IBM® Digital Analytics permanent cookie set in every browser visiting the tagged site.
|
2197
|
+
*
|
2198
|
+
* @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_registrationtag.html
|
2199
|
+
*/
|
2200
|
+
case 'cmCreateRegistrationTag':
|
2201
|
+
const cmCreateRegistrationTag = window['cmCreateRegistrationTag'];
|
2202
|
+
cmCreateRegistrationTag(properties.registrationId, properties.registrantEmail, properties.registrantCity, properties.registrantState, properties.registrantPostalCode, properties.registrantCountry, properties.attrbute);
|
2203
|
+
break;
|
2204
|
+
/**
|
2205
|
+
* @description The Element tag is used to track intra-page content in IBM® Digital Analytics. Data collected by
|
2206
|
+
* the Element tag is used to populate values in the Element Categories and Top Viewed Elements reports.
|
2207
|
+
*
|
2208
|
+
* @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_elementtag.html
|
2209
|
+
*/
|
2210
|
+
case 'cmCreateElementTag':
|
2211
|
+
const cmCreateElementTag = window['cmCreateElementTag'];
|
2212
|
+
cmCreateElementTag(properties.elementId, properties.elementCategory, properties.attrbute);
|
2213
|
+
break;
|
2214
|
+
/**
|
2215
|
+
* @description The Conversion Event tag is employed for tracking of general non-commerce conversion events.
|
2216
|
+
* The Conversion Event tag is used to populate values in the Conversion Events Reports and to create Key Segments.
|
2217
|
+
* This tag and the reports it populates enable analysis of a wide variety of site activities.
|
2218
|
+
*
|
2219
|
+
* @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_conversioneventtag.html
|
2220
|
+
*/
|
2221
|
+
case 'cmCreateConversionEventTag':
|
2222
|
+
const cmCreateConversionEventTag = window['cmCreateConversionEventTag'];
|
2223
|
+
cmCreateConversionEventTag(properties.eventId, properties.actionType, properties.eventCategoryId, properties.points, properties.attrbute, properties.extraFields);
|
2224
|
+
break;
|
2225
|
+
default:
|
2226
|
+
console.warn('Unsupported Event Action');
|
2227
|
+
}
|
2228
|
+
}
|
2229
|
+
}
|
2230
|
+
Angulartics2IBMDigitalAnalytics.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2IBMDigitalAnalytics, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
2231
|
+
Angulartics2IBMDigitalAnalytics.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2IBMDigitalAnalytics, providedIn: 'root' });
|
2232
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2IBMDigitalAnalytics, decorators: [{
|
2233
|
+
type: Injectable,
|
2234
|
+
args: [{ providedIn: 'root' }]
|
2235
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
2236
|
+
|
2237
|
+
class Angulartics2GoSquared {
|
2238
|
+
constructor(angulartics2) {
|
2239
|
+
this.angulartics2 = angulartics2;
|
2240
|
+
this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));
|
2241
|
+
this.angulartics2.setUserPropertiesOnce.subscribe(x => this.setUserProperties(x));
|
2242
|
+
}
|
2243
|
+
startTracking() {
|
2244
|
+
this.angulartics2.pageTrack
|
2245
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
2246
|
+
.subscribe(x => this.pageTrack(x.path));
|
2247
|
+
this.angulartics2.eventTrack
|
2248
|
+
.pipe(this.angulartics2.filterDeveloperMode())
|
2249
|
+
.subscribe(x => this.eventTrack(x.action, x.properties));
|
2250
|
+
}
|
2251
|
+
pageTrack(path) {
|
2252
|
+
try {
|
2253
|
+
_gs('track', path);
|
2254
|
+
}
|
2255
|
+
catch (e) {
|
2256
|
+
if (!(e instanceof ReferenceError)) {
|
2257
|
+
throw e;
|
2258
|
+
}
|
2259
|
+
}
|
2260
|
+
}
|
2261
|
+
eventTrack(action, properties) {
|
2262
|
+
try {
|
2263
|
+
_gs('event', action, properties);
|
2264
|
+
}
|
2265
|
+
catch (e) {
|
2266
|
+
if (!(e instanceof ReferenceError)) {
|
2267
|
+
throw e;
|
2268
|
+
}
|
2269
|
+
}
|
2270
|
+
}
|
2271
|
+
setUserProperties(properties) {
|
2272
|
+
try {
|
2273
|
+
_gs('identify', properties);
|
2274
|
+
}
|
2275
|
+
catch (e) {
|
2276
|
+
if (!(e instanceof ReferenceError)) {
|
2277
|
+
throw e;
|
2278
|
+
}
|
2279
|
+
}
|
2280
|
+
}
|
2281
|
+
}
|
2282
|
+
Angulartics2GoSquared.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoSquared, deps: [{ token: Angulartics2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
2283
|
+
Angulartics2GoSquared.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoSquared, providedIn: 'root' });
|
2284
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Angulartics2GoSquared, decorators: [{
|
2285
|
+
type: Injectable,
|
2286
|
+
args: [{ providedIn: 'root' }]
|
2287
|
+
}], ctorParameters: function () { return [{ type: Angulartics2 }]; } });
|
2288
|
+
|
2289
|
+
/**
|
2290
|
+
* Generated bundle index. Do not edit.
|
2291
|
+
*/
|
2292
|
+
|
2293
|
+
export { ANGULARTICS2_TOKEN, AngularRouterTracking, Angulartics2, Angulartics2AdobeAnalytics, Angulartics2Amplitude, Angulartics2AppInsights, Angulartics2BaiduAnalytics, Angulartics2Clicky, Angulartics2Facebook, Angulartics2GoSquared, Angulartics2GoogleAnalytics, Angulartics2GoogleAnalyticsEnhancedEcommerce, Angulartics2GoogleGlobalSiteTag, Angulartics2GoogleTagManager, Angulartics2Hubspot, Angulartics2IBMDigitalAnalytics, Angulartics2Intercom, Angulartics2Kissmetrics, Angulartics2LaunchByAdobe, Angulartics2Matomo, Angulartics2Mixpanel, Angulartics2Module, Angulartics2On, Angulartics2OnModule, Angulartics2Pyze, Angulartics2RouterlessModule, Angulartics2Segment, Angulartics2Splunk, Angulartics2Woopra, AppInsightsDefaults, DefaultConfig, GoogleAnalyticsDefaults, GoogleGlobalSiteTagDefaults, GoogleTagManagerDefaults, RouterlessTracking };
|
2294
|
+
//# sourceMappingURL=angulartics2.mjs.map
|