1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('angulartics2')) :
|
3 | typeof define === 'function' && define.amd ? define('angulartics2/pyze', ['exports', '@angular/core', 'angulartics2'], factory) :
|
4 | (global = global || self, factory((global.angulartics2 = global.angulartics2 || {}, global.angulartics2.pyze = {}), global.ng.core, global.angulartics2));
|
5 | }(this, (function (exports, i0, i1) { 'use strict';
|
6 |
|
7 | var Angulartics2Pyze = (function () {
|
8 | function Angulartics2Pyze(angulartics2) {
|
9 | var _this = this;
|
10 | this.angulartics2 = angulartics2;
|
11 | this.angulartics2.setUsername.subscribe(function (x) { return _this.setUserId(x); });
|
12 | this.angulartics2.setUserProperties.subscribe(function (x) { return _this.postTraits(x); });
|
13 | }
|
14 | Angulartics2Pyze.prototype.startTracking = function () {
|
15 | var _this = this;
|
16 | this.angulartics2.pageTrack
|
17 | .pipe(this.angulartics2.filterDeveloperMode())
|
18 | .subscribe(function (x) { return _this.pageTrack(x.path); });
|
19 | this.angulartics2.eventTrack
|
20 | .pipe(this.angulartics2.filterDeveloperMode())
|
21 | .subscribe(function (x) { return _this.eventTrack(x.action, x.properties); });
|
22 | };
|
23 | Angulartics2Pyze.prototype.pageTrack = function (path) {
|
24 | try {
|
25 | Pyze.postPageView('Page Viewed', { page: path });
|
26 | }
|
27 | catch (e) {
|
28 | if (!(e instanceof ReferenceError)) {
|
29 | throw e;
|
30 | }
|
31 | }
|
32 | };
|
33 | Angulartics2Pyze.prototype.eventTrack = function (action, properties) {
|
34 | try {
|
35 | PyzeEvents.postCustomEventWithAttributes(action, properties);
|
36 | }
|
37 | catch (e) {
|
38 | if (!(e instanceof ReferenceError)) {
|
39 | throw e;
|
40 | }
|
41 | }
|
42 | };
|
43 | Angulartics2Pyze.prototype.setUserId = function (userId) {
|
44 | try {
|
45 | PyzeIdentity.setUserIdentifier(userId);
|
46 | }
|
47 | catch (e) {
|
48 | if (!(e instanceof ReferenceError)) {
|
49 | throw e;
|
50 | }
|
51 | }
|
52 | };
|
53 | Angulartics2Pyze.prototype.postTraits = function (properties) {
|
54 | try {
|
55 | PyzeIdentity.postTraits(properties);
|
56 | }
|
57 | catch (e) {
|
58 | if (!(e instanceof ReferenceError)) {
|
59 | throw e;
|
60 | }
|
61 | }
|
62 | };
|
63 | return Angulartics2Pyze;
|
64 | }());
|
65 | Angulartics2Pyze.ɵprov = i0.ɵɵdefineInjectable({ factory: function Angulartics2Pyze_Factory() { return new Angulartics2Pyze(i0.ɵɵinject(i1.Angulartics2)); }, token: Angulartics2Pyze, providedIn: "root" });
|
66 | Angulartics2Pyze.decorators = [
|
67 | { type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
68 | ];
|
69 | Angulartics2Pyze.ctorParameters = function () { return [
|
70 | { type: i1.Angulartics2 }
|
71 | ]; };
|
72 |
|
73 | |
74 |
|
75 |
|
76 |
|
77 | exports.Angulartics2Pyze = Angulartics2Pyze;
|
78 |
|
79 | Object.defineProperty(exports, '__esModule', { value: true });
|
80 |
|
81 | })));
|
82 |
|