angulartics2 10.0.0 → 10.1.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/README.md +1 -1
- package/{piwik → matomo}/README.md +20 -20
- package/{piwik/angulartics2-piwik.d.ts → matomo/angulartics2-matomo.d.ts} +1 -1
- package/matomo/angulartics2-matomo.metadata.json +1 -0
- package/{piwik/bundles/angulartics2-piwik.umd.js → matomo/bundles/angulartics2-matomo.umd.js} +79 -38
- package/matomo/bundles/angulartics2-matomo.umd.js.map +1 -0
- package/matomo/bundles/angulartics2-matomo.umd.min.js +2 -0
- package/matomo/bundles/angulartics2-matomo.umd.min.js.map +1 -0
- package/matomo/esm2015/angulartics2-matomo.js +5 -0
- package/matomo/esm2015/matomo.js +294 -0
- package/{piwik/fesm2015/angulartics2-piwik.js → matomo/fesm2015/angulartics2-matomo.js} +71 -29
- package/matomo/fesm2015/angulartics2-matomo.js.map +1 -0
- package/matomo/matomo.d.ts +137 -0
- package/matomo/package.json +20 -0
- package/package.json +2 -2
- package/piwik/angulartics2-piwik.metadata.json +0 -1
- package/piwik/bundles/angulartics2-piwik.umd.js.map +0 -1
- package/piwik/bundles/angulartics2-piwik.umd.min.js +0 -2
- package/piwik/bundles/angulartics2-piwik.umd.min.js.map +0 -1
- package/piwik/esm2015/angulartics2-piwik.js +0 -5
- package/piwik/esm2015/piwik.js +0 -252
- package/piwik/fesm2015/angulartics2-piwik.js.map +0 -1
- package/piwik/package.json +0 -20
- package/piwik/piwik.d.ts +0 -27
package/README.md
CHANGED
@@ -275,7 +275,7 @@ System.config({
|
|
275
275
|
* [Google Global Site Tag](/src/lib/providers/gst) (`gtag.js`)
|
276
276
|
* [Kissmetrics](/src/lib/providers/kissmetrics)
|
277
277
|
* [Mixpanel](/src/lib/providers/mixpanel)
|
278
|
-
* [
|
278
|
+
* [Matomo](/src/lib/providers/matomo)
|
279
279
|
* [Segment](/src/lib/providers/segment)
|
280
280
|
* [Baidu Analytics](/src/lib/providers/baidu)
|
281
281
|
* [Facebook Pixel](/src/lib/providers/facebook)
|
@@ -1,41 +1,41 @@
|
|
1
1
|
<img
|
2
|
-
src="../../../assets/svg/
|
3
|
-
alt="
|
2
|
+
src="../../../assets/svg/matomo.svg"
|
3
|
+
alt="Matomo logo"
|
4
4
|
height="100px"
|
5
5
|
width="200px" />
|
6
6
|
|
7
|
-
#
|
8
|
-
__homepage__: [
|
9
|
-
__docs__: [developer.
|
10
|
-
__import__: `import {
|
7
|
+
# Matomo
|
8
|
+
__homepage__: [matomo.org](https://matomo.org)
|
9
|
+
__docs__: [developer.matomo.org](https://developer.matomo.org)
|
10
|
+
__import__: `import { Angulartics2Matomo } from 'angulartics2/matomo';`
|
11
11
|
|
12
12
|
## Setup
|
13
|
-
Add the standard
|
13
|
+
Add the standard matomo track code inside your index.html head tag:
|
14
14
|
```html
|
15
|
-
<!--
|
15
|
+
<!-- Matomo -->
|
16
16
|
<script type="text/javascript">
|
17
17
|
var _paq = _paq || [];
|
18
18
|
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
19
19
|
// _paq.push(['trackPageView']); // DELETE THIS LINE
|
20
20
|
_paq.push(['enableLinkTracking']);
|
21
21
|
(function() {
|
22
|
-
var u="//
|
23
|
-
_paq.push(['setTrackerUrl', u+'
|
22
|
+
var u="//matomo.YOUR-DOMAIN.com/";
|
23
|
+
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
24
24
|
_paq.push(['setSiteId', '11']);
|
25
25
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
26
|
-
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'
|
26
|
+
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
27
27
|
})();
|
28
28
|
</script>
|
29
|
-
<!-- End
|
29
|
+
<!-- End Matomo Code -->
|
30
30
|
```
|
31
31
|
Make sure "trackPageView" line is commented or deleted. It is not needed as page tracking will be trigger by the angular module on route change.
|
32
32
|
|
33
|
-
Replace YOUR-DOMAIN with your
|
33
|
+
Replace YOUR-DOMAIN with your matomo domain (`//DOMAIN.innocraft.cloud` if you are using the innocraft cloud service).
|
34
34
|
|
35
|
-
Pass the
|
35
|
+
Pass the Matomo provider to angulartics in app.module:
|
36
36
|
```ts
|
37
37
|
import { Angulartics2Module } from 'angulartics2';
|
38
|
-
import {
|
38
|
+
import { Angulartics2Matomo } from 'angulartics2/matomo';
|
39
39
|
@NgModule({
|
40
40
|
imports: [
|
41
41
|
Angulartics2Module.forRoot(),
|
@@ -44,11 +44,11 @@ import { Angulartics2Piwik } from 'angulartics2/piwik';
|
|
44
44
|
|
45
45
|
Inject angulartics into your root component (usually appComponent)
|
46
46
|
```ts
|
47
|
-
import {
|
47
|
+
import { Angulartics2Matomo } from 'angulartics2/matomo';
|
48
48
|
export class AppComponent {
|
49
|
-
// inject
|
50
|
-
constructor(private
|
51
|
-
|
49
|
+
// inject Angulartics2Matomo in root component and initialize it
|
50
|
+
constructor(private angulartics2Matomo: Angulartics2Matomo) {
|
51
|
+
angulartics2Matomo.startTracking();
|
52
52
|
}
|
53
53
|
}
|
54
54
|
```
|
@@ -69,6 +69,6 @@ angulartics2.setUserProperties.next({
|
|
69
69
|
```
|
70
70
|
Note: Custom Variables and Custom Dimensions cannot be tracked in the same call, and requires separate setUserProperties calls
|
71
71
|
|
72
|
-
To track full URLs if there is a hash (#), make sure to enable `settings=>websites=>settings=>page url fragments tracking` in the
|
72
|
+
To track full URLs if there is a hash (#), make sure to enable `settings=>websites=>settings=>page url fragments tracking` in the Matomo dashboard.
|
73
73
|
|
74
74
|
Once set up, Angulartics [usage](https://github.com/angulartics/angulartics2#usage) is the same regardless of provider
|
@@ -0,0 +1 @@
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"EventTrackAction":{"__symbolic":"interface"},"ScopeMatomo":{"__symbolic":"interface"},"DimensionsMatomoProperties":{"__symbolic":"interface"},"SetEcommerceViewMatomoProperties":{"__symbolic":"interface"},"AddEcommerceItemProperties":{"__symbolic":"interface"},"TrackEcommerceCartUpdateMatomoProperties":{"__symbolic":"interface"},"TrackEcommerceOrderMatomoProperties":{"__symbolic":"interface"},"TrackLinkMatomoProperties":{"__symbolic":"interface"},"TrackGoalMatomoProperties":{"__symbolic":"interface"},"TrackSiteSearchMatomoProperties":{"__symbolic":"interface"},"TrackEventMatomoProperties":{"__symbolic":"interface"},"SetCustomVariableMatomoProperties":{"__symbolic":"interface"},"DeleteCustomVariableMatomoProperties":{"__symbolic":"interface"},"EventTrackactionProperties":{"__symbolic":"interface"},"Angulartics2Matomo":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":129,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"angulartics2","name":"Angulartics2","line":132,"character":36}]}],"startTracking":[{"__symbolic":"method"}],"pageTrack":[{"__symbolic":"method"}],"resetUser":[{"__symbolic":"method"}],"eventTrack":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"setUsername":[{"__symbolic":"method"}],"setUserProperties":[{"__symbolic":"method"}],"deletedUserProperties":[{"__symbolic":"method"}],"setCustomDimensions":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}},"origins":{"EventTrackAction":"./matomo","ScopeMatomo":"./matomo","DimensionsMatomoProperties":"./matomo","SetEcommerceViewMatomoProperties":"./matomo","AddEcommerceItemProperties":"./matomo","TrackEcommerceCartUpdateMatomoProperties":"./matomo","TrackEcommerceOrderMatomoProperties":"./matomo","TrackLinkMatomoProperties":"./matomo","TrackGoalMatomoProperties":"./matomo","TrackSiteSearchMatomoProperties":"./matomo","TrackEventMatomoProperties":"./matomo","SetCustomVariableMatomoProperties":"./matomo","DeleteCustomVariableMatomoProperties":"./matomo","EventTrackactionProperties":"./matomo","Angulartics2Matomo":"./matomo"},"importAs":"angulartics2/matomo"}
|
package/{piwik/bundles/angulartics2-piwik.umd.js → matomo/bundles/angulartics2-matomo.umd.js}
RENAMED
@@ -1,22 +1,22 @@
|
|
1
1
|
(function (global, factory) {
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('angulartics2')) :
|
3
|
-
typeof define === 'function' && define.amd ? define('angulartics2/
|
4
|
-
(global = global || self, factory((global.angulartics2 = global.angulartics2 || {}, global.angulartics2.
|
3
|
+
typeof define === 'function' && define.amd ? define('angulartics2/matomo', ['exports', '@angular/core', 'angulartics2'], factory) :
|
4
|
+
(global = global || self, factory((global.angulartics2 = global.angulartics2 || {}, global.angulartics2.matomo = {}), global.ng.core, global.angulartics2));
|
5
5
|
}(this, (function (exports, i0, i1) { 'use strict';
|
6
6
|
|
7
|
-
var
|
8
|
-
function
|
7
|
+
var Angulartics2Matomo = /** @class */ (function () {
|
8
|
+
function Angulartics2Matomo(angulartics2) {
|
9
9
|
var _this = this;
|
10
10
|
this.angulartics2 = angulartics2;
|
11
11
|
if (typeof (_paq) === 'undefined') {
|
12
|
-
console.warn('
|
12
|
+
console.warn('Matomo not found');
|
13
13
|
}
|
14
14
|
this.angulartics2.setUsername
|
15
15
|
.subscribe(function (x) { return _this.setUsername(x); });
|
16
16
|
this.angulartics2.setUserProperties
|
17
17
|
.subscribe(function (x) { return _this.setUserProperties(x); });
|
18
18
|
}
|
19
|
-
|
19
|
+
Angulartics2Matomo.prototype.startTracking = function () {
|
20
20
|
var _this = this;
|
21
21
|
this.angulartics2.pageTrack
|
22
22
|
.pipe(this.angulartics2.filterDeveloperMode())
|
@@ -25,14 +25,14 @@
|
|
25
25
|
.pipe(this.angulartics2.filterDeveloperMode())
|
26
26
|
.subscribe(function (x) { return _this.eventTrack(x.action, x.properties); });
|
27
27
|
};
|
28
|
-
|
28
|
+
Angulartics2Matomo.prototype.pageTrack = function (path, title) {
|
29
29
|
try {
|
30
30
|
if (!window.location.origin) {
|
31
31
|
window.location.origin = window.location.protocol + '//'
|
32
32
|
+ window.location.hostname
|
33
33
|
+ (window.location.port ? ':' + window.location.port : '');
|
34
34
|
}
|
35
|
-
_paq.push(['setDocumentTitle', window.document.title]);
|
35
|
+
_paq.push(['setDocumentTitle', title || window.document.title]);
|
36
36
|
_paq.push(['setCustomUrl', window.location.origin + path]);
|
37
37
|
_paq.push(['trackPageView']);
|
38
38
|
}
|
@@ -42,14 +42,24 @@
|
|
42
42
|
}
|
43
43
|
}
|
44
44
|
};
|
45
|
+
Angulartics2Matomo.prototype.resetUser = function () {
|
46
|
+
try {
|
47
|
+
_paq.push(['appendToTrackingUrl', 'new_visit=1']); // (1) forces a new visit
|
48
|
+
_paq.push(['deleteCookies']); // (2) deletes existing tracking cookies to start the new visit
|
49
|
+
}
|
50
|
+
catch (e) {
|
51
|
+
if (!(e instanceof ReferenceError)) {
|
52
|
+
throw e;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
};
|
45
56
|
/**
|
46
|
-
* Track a basic event in
|
57
|
+
* Track a basic event in Matomo, or send an ecommerce event.
|
47
58
|
*
|
48
59
|
* @param action A string corresponding to the type of event that needs to be tracked.
|
49
60
|
* @param properties The properties that need to be logged with the event.
|
50
61
|
*/
|
51
|
-
|
52
|
-
if (properties === void 0) { properties = {}; }
|
62
|
+
Angulartics2Matomo.prototype.eventTrack = function (action, properties) {
|
53
63
|
var params = [];
|
54
64
|
switch (action) {
|
55
65
|
/**
|
@@ -57,8 +67,8 @@
|
|
57
67
|
* setEcommerceView it must be followed by a call to trackPageView to record the product or
|
58
68
|
* category page view.
|
59
69
|
*
|
60
|
-
* @link https://
|
61
|
-
* @link https://developer.
|
70
|
+
* @link https://matomo.org/docs/ecommerce-analytics/#tracking-product-page-views-category-page-views-optional
|
71
|
+
* @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce
|
62
72
|
*
|
63
73
|
* @property productSKU (required) SKU: Product unique identifier
|
64
74
|
* @property productName (optional) Product name
|
@@ -66,8 +76,7 @@
|
|
66
76
|
* @property price (optional) Product Price as displayed on the page
|
67
77
|
*/
|
68
78
|
case 'setEcommerceView':
|
69
|
-
params = ['setEcommerceView',
|
70
|
-
properties.productSKU,
|
79
|
+
params = ['setEcommerceView', properties.productSKU,
|
71
80
|
properties.productName,
|
72
81
|
properties.categoryName,
|
73
82
|
properties.price,
|
@@ -77,8 +86,8 @@
|
|
77
86
|
* @description Adds a product into the ecommerce order. Must be called for each product in
|
78
87
|
* the order.
|
79
88
|
*
|
80
|
-
* @link https://
|
81
|
-
* @link https://developer.
|
89
|
+
* @link https://matomo.org/docs/ecommerce-analytics/#tracking-ecommerce-orders-items-purchased-required
|
90
|
+
* @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce
|
82
91
|
*
|
83
92
|
* @property productSKU (required) SKU: Product unique identifier
|
84
93
|
* @property productName (optional) Product name
|
@@ -100,8 +109,8 @@
|
|
100
109
|
* @description Tracks a shopping cart. Call this javascript function every time a user is
|
101
110
|
* adding, updating or deleting a product from the cart.
|
102
111
|
*
|
103
|
-
* @link https://
|
104
|
-
* @link https://developer.
|
112
|
+
* @link https://matomo.org/docs/ecommerce-analytics/#tracking-add-to-cart-items-added-to-the-cart-optional
|
113
|
+
* @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce
|
105
114
|
*
|
106
115
|
* @property grandTotal (required) Cart amount
|
107
116
|
*/
|
@@ -112,8 +121,8 @@
|
|
112
121
|
* @description Tracks an Ecommerce order, including any ecommerce item previously added to
|
113
122
|
* the order. orderId and grandTotal (ie. revenue) are required parameters.
|
114
123
|
*
|
115
|
-
* @link https://
|
116
|
-
* @link https://developer.
|
124
|
+
* @link https://matomo.org/docs/ecommerce-analytics/#tracking-ecommerce-orders-items-purchased-required
|
125
|
+
* @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce
|
117
126
|
*
|
118
127
|
* @property orderId (required) Unique Order ID
|
119
128
|
* @property grandTotal (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)
|
@@ -133,11 +142,27 @@
|
|
133
142
|
properties.discount,
|
134
143
|
];
|
135
144
|
break;
|
145
|
+
/**
|
146
|
+
* @description To manually trigger an outlink
|
147
|
+
*
|
148
|
+
* @link https://matomo.org/docs/tracking-goals-web-analytics/
|
149
|
+
* @link https://developer.matomo.org/guides/tracking-javascript-guide#tracking-a-click-as-an-outlink-via-css-or-javascript
|
150
|
+
*
|
151
|
+
* @property url (required) link url
|
152
|
+
* @property linkType (optional) type of link
|
153
|
+
*/
|
154
|
+
case 'trackLink':
|
155
|
+
params = [
|
156
|
+
'trackLink',
|
157
|
+
properties.url,
|
158
|
+
properties.linkType
|
159
|
+
];
|
160
|
+
break;
|
136
161
|
/**
|
137
162
|
* @description Tracks an Ecommerce goal
|
138
163
|
*
|
139
|
-
* @link https://
|
140
|
-
* @link https://developer.
|
164
|
+
* @link https://matomo.org/docs/tracking-goals-web-analytics/
|
165
|
+
* @link https://developer.matomo.org/guides/tracking-javascript-guide#manually-trigger-goal-conversions
|
141
166
|
*
|
142
167
|
* @property goalId (required) Unique Goal ID
|
143
168
|
* @property value (optional) passed to goal tracking
|
@@ -152,8 +177,8 @@
|
|
152
177
|
/**
|
153
178
|
* @description Tracks a site search
|
154
179
|
*
|
155
|
-
* @link https://
|
156
|
-
* @link https://developer.
|
180
|
+
* @link https://matomo.org/docs/site-search/
|
181
|
+
* @link https://developer.matomo.org/guides/tracking-javascript-guide#internal-search-tracking
|
157
182
|
*
|
158
183
|
* @property keyword (required) Keyword searched for
|
159
184
|
* @property category (optional) Search category
|
@@ -172,8 +197,8 @@
|
|
172
197
|
* action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...), and an optional
|
173
198
|
* event name and optional numeric value.
|
174
199
|
*
|
175
|
-
* @link https://
|
176
|
-
* @link https://developer.
|
200
|
+
* @link https://matomo.org/docs/event-tracking/
|
201
|
+
* @link https://developer.matomo.org/api-reference/tracking-javascript#using-the-tracker-object
|
177
202
|
*
|
178
203
|
* @property category
|
179
204
|
* @property action
|
@@ -181,7 +206,7 @@
|
|
181
206
|
* @property value (optional)
|
182
207
|
*/
|
183
208
|
default:
|
184
|
-
// PAQ requires that eventValue be an integer, see: http://
|
209
|
+
// PAQ requires that eventValue be an integer, see: http://matomo.org/docs/event-tracking
|
185
210
|
if (properties.value) {
|
186
211
|
var parsed = parseInt(properties.value, 10);
|
187
212
|
properties.value = isNaN(parsed) ? 0 : parsed;
|
@@ -203,7 +228,7 @@
|
|
203
228
|
}
|
204
229
|
}
|
205
230
|
};
|
206
|
-
|
231
|
+
Angulartics2Matomo.prototype.setUsername = function (userId) {
|
207
232
|
try {
|
208
233
|
_paq.push(['setUserId', userId]);
|
209
234
|
}
|
@@ -221,9 +246,9 @@
|
|
221
246
|
* object is saved as a custom variable.
|
222
247
|
*
|
223
248
|
* If in doubt, prefer custom dimensions.
|
224
|
-
* @link https://
|
249
|
+
* @link https://matomo.org/docs/custom-variables/
|
225
250
|
*/
|
226
|
-
|
251
|
+
Angulartics2Matomo.prototype.setUserProperties = function (properties) {
|
227
252
|
var dimensions = this.setCustomDimensions(properties);
|
228
253
|
try {
|
229
254
|
if (dimensions.length === 0) {
|
@@ -236,7 +261,23 @@
|
|
236
261
|
}
|
237
262
|
}
|
238
263
|
};
|
239
|
-
|
264
|
+
/**
|
265
|
+
* If you created a custom variable and then decide to remove this variable from
|
266
|
+
* a visit or page view, you can use deleteCustomVariable.
|
267
|
+
*
|
268
|
+
* @link https://developer.matomo.org/guides/tracking-javascript-guide#deleting-a-custom-variable
|
269
|
+
*/
|
270
|
+
Angulartics2Matomo.prototype.deletedUserProperties = function (properties) {
|
271
|
+
try {
|
272
|
+
_paq.push(['deleteCustomVariable', properties.index, properties.scope]);
|
273
|
+
}
|
274
|
+
catch (e) {
|
275
|
+
if (!(e instanceof ReferenceError)) {
|
276
|
+
throw e;
|
277
|
+
}
|
278
|
+
}
|
279
|
+
};
|
280
|
+
Angulartics2Matomo.prototype.setCustomDimensions = function (properties) {
|
240
281
|
var dimensionRegex = /dimension[1-9]\d*/;
|
241
282
|
var dimensions = Object.keys(properties)
|
242
283
|
.filter(function (key) { return dimensionRegex.exec(key); });
|
@@ -246,13 +287,13 @@
|
|
246
287
|
});
|
247
288
|
return dimensions;
|
248
289
|
};
|
249
|
-
return
|
290
|
+
return Angulartics2Matomo;
|
250
291
|
}());
|
251
|
-
|
252
|
-
|
292
|
+
Angulartics2Matomo.ɵprov = i0.ɵɵdefineInjectable({ factory: function Angulartics2Matomo_Factory() { return new Angulartics2Matomo(i0.ɵɵinject(i1.Angulartics2)); }, token: Angulartics2Matomo, providedIn: "root" });
|
293
|
+
Angulartics2Matomo.decorators = [
|
253
294
|
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
254
295
|
];
|
255
|
-
|
296
|
+
Angulartics2Matomo.ctorParameters = function () { return [
|
256
297
|
{ type: i1.Angulartics2 }
|
257
298
|
]; };
|
258
299
|
|
@@ -260,9 +301,9 @@
|
|
260
301
|
* Generated bundle index. Do not edit.
|
261
302
|
*/
|
262
303
|
|
263
|
-
exports.
|
304
|
+
exports.Angulartics2Matomo = Angulartics2Matomo;
|
264
305
|
|
265
306
|
Object.defineProperty(exports, '__esModule', { value: true });
|
266
307
|
|
267
308
|
})));
|
268
|
-
//# sourceMappingURL=angulartics2-
|
309
|
+
//# sourceMappingURL=angulartics2-matomo.umd.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"angulartics2-matomo.umd.js","sources":["../../../../src/lib/providers/matomo/matomo.ts","../../../../src/lib/providers/matomo/angulartics2-matomo.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { Angulartics2 } from 'angulartics2';\n\ndeclare var _paq: any;\n\nexport type EventTrackAction = 'setEcommerceView' | 'addEcommerceItem' | 'trackEcommerceCartUpdate'\n | 'trackEcommerceOrder' | 'trackLink' | 'trackGoal' | 'trackSiteSearch' | string;\n\nexport type ScopeMatomo = 'visit' | 'page';\n\n\nexport interface DimensionsMatomoProperties {\n dimension0?: string;\n dimension1?: string;\n dimension2?: string;\n dimension3?: string;\n dimension4?: string;\n dimension5?: string;\n dimension6?: string;\n dimension7?: string;\n dimension8?: string;\n dimension9?: string;\n}\nexport interface SetEcommerceViewMatomoProperties {\n /** @class SetEcommerceViewMatomoProperties */\n productSKU: string;\n /** @class SetEcommerceViewMatomoProperties */\n productName: string;\n /** @class SetEcommerceViewMatomoProperties */\n categoryName: string;\n /** @class SetEcommerceViewMatomoProperties */\n price: string;\n}\n\nexport interface AddEcommerceItemProperties {\n /** @class AddEcommerceItemProperties */\n productSKU: string;\n /** @class AddEcommerceItemProperties */\n productName: string;\n /** @class AddEcommerceItemProperties */\n productCategory: string;\n /** @class AddEcommerceItemProperties */\n price: string;\n /** @class AddEcommerceItemProperties */\n quantity: string;\n}\n\nexport interface TrackEcommerceCartUpdateMatomoProperties {\n /** @class TrackEcommerceCartUpdateMatomoProperties */\n grandTotal: string;\n}\n\nexport interface TrackEcommerceOrderMatomoProperties {\n /** @class TrackEcommerceOrderMatomoProperties */\n orderId: string;\n /** @class TrackEcommerceOrderMatomoProperties */\n grandTotal: string;\n /** @class TrackEcommerceOrderMatomoProperties */\n subTotal: string;\n /** @class TrackEcommerceOrderMatomoProperties */\n tax: string;\n /** @class TrackEcommerceOrderMatomoProperties */\n shipping: string;\n /** @class TrackEcommerceOrderMatomoProperties */\n discount: string;\n}\n\nexport interface TrackLinkMatomoProperties {\n /** @class TrackLinkMatomoProperties */\n url: string;\n /** @class TrackLinkMatomoProperties */\n linkType: string;\n}\n\nexport interface TrackGoalMatomoProperties {\n /** @class TrackGoalMatomoProperties */\n goalId: string;\n /** @class TrackGoalMatomoProperties */\n value: string;\n}\n\nexport interface TrackSiteSearchMatomoProperties {\n /** @class TrackSiteSearchMatomoProperties */\n keyword: string;\n /** @class TrackSiteSearchMatomoProperties */\n category: string;\n /** @class TrackSiteSearchMatomoProperties */\n searchCount: string;\n}\n\nexport interface TrackEventMatomoProperties {\n /** @class TrackEventMatomoProperties */\n category: string;\n /** @class TrackEventMatomoProperties */\n name?: string;\n /** @class TrackEventMatomoProperties */\n label?: string;\n /** @class TrackEventMatomoProperties */\n value: number | string;\n}\n\nexport interface SetCustomVariableMatomoProperties extends DimensionsMatomoProperties {\n /** @class SetCustomVariableMatomoProperties */\n index: number;\n /** @class SetCustomVariableMatomoProperties */\n name: string;\n /** @class SetCustomVariableMatomoProperties */\n value: string;\n /** @class SetCustomVariableMatomoProperties */\n scope: ScopeMatomo;\n}\n\nexport interface DeleteCustomVariableMatomoProperties {\n /** @class DeleteCustomVariableMatomoProperties */\n index: number;\n /** @class DeleteCustomVariableMatomoProperties */\n scope: ScopeMatomo;\n}\n\nexport type EventTrackactionProperties = SetEcommerceViewMatomoProperties\n | AddEcommerceItemProperties\n | TrackEcommerceCartUpdateMatomoProperties\n | TrackEcommerceOrderMatomoProperties\n | TrackLinkMatomoProperties\n | TrackGoalMatomoProperties\n | TrackSiteSearchMatomoProperties\n | TrackEventMatomoProperties;\n\n@Injectable({ providedIn: 'root' })\nexport class Angulartics2Matomo {\n\n constructor(private angulartics2: Angulartics2) {\n if (typeof (_paq) === 'undefined') {\n console.warn('Matomo not found');\n }\n this.angulartics2.setUsername\n .subscribe((x: string) => this.setUsername(x));\n this.angulartics2.setUserProperties\n .subscribe((x: SetCustomVariableMatomoProperties) => this.setUserProperties(x));\n }\n\n startTracking(): void {\n this.angulartics2.pageTrack\n .pipe(this.angulartics2.filterDeveloperMode())\n .subscribe((x) => this.pageTrack(x.path));\n this.angulartics2.eventTrack\n .pipe(this.angulartics2.filterDeveloperMode())\n .subscribe((x) => this.eventTrack(x.action, x.properties));\n }\n\n pageTrack(path: string, title?: string) {\n try {\n if (!window.location.origin) {\n (window.location as any).origin = window.location.protocol + '//'\n + window.location.hostname\n + (window.location.port ? ':' + window.location.port : '');\n }\n _paq.push(['setDocumentTitle', title || window.document.title]);\n _paq.push(['setCustomUrl', window.location.origin + path]);\n _paq.push(['trackPageView']);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n resetUser() {\n try {\n _paq.push(['appendToTrackingUrl', 'new_visit=1']); // (1) forces a new visit\n _paq.push(['deleteCookies']); // (2) deletes existing tracking cookies to start the new visit\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n eventTrack(action: 'setEcommerceView', properties: SetEcommerceViewMatomoProperties): void;\n eventTrack(action: 'addEcommerceItem', properties: AddEcommerceItemProperties): void;\n eventTrack(action: 'trackEcommerceCartUpdate', properties: TrackEcommerceCartUpdateMatomoProperties): void;\n eventTrack(action: 'trackEcommerceOrder', properties: TrackEcommerceOrderMatomoProperties): void;\n eventTrack(action: 'trackLink', properties: TrackLinkMatomoProperties): void;\n eventTrack(action: 'trackGoal', properties: TrackGoalMatomoProperties): void;\n eventTrack(action: 'trackSiteSearch', properties: TrackSiteSearchMatomoProperties): void;\n eventTrack(action: string, properties: TrackEventMatomoProperties): void;\n\n /**\n * Track a basic event in Matomo, or send an ecommerce event.\n *\n * @param action A string corresponding to the type of event that needs to be tracked.\n * @param properties The properties that need to be logged with the event.\n */\n eventTrack(action: EventTrackAction, properties?: EventTrackactionProperties) {\n let params = [];\n switch (action) {\n /**\n * @description Sets the current page view as a product or category page view. When you call\n * setEcommerceView it must be followed by a call to trackPageView to record the product or\n * category page view.\n *\n * @link https://matomo.org/docs/ecommerce-analytics/#tracking-product-page-views-category-page-views-optional\n * @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce\n *\n * @property productSKU (required) SKU: Product unique identifier\n * @property productName (optional) Product name\n * @property categoryName (optional) Product category, or array of up to 5 categories\n * @property price (optional) Product Price as displayed on the page\n */\n case 'setEcommerceView':\n params = ['setEcommerceView',\n (properties as SetEcommerceViewMatomoProperties).productSKU,\n (properties as SetEcommerceViewMatomoProperties).productName,\n (properties as SetEcommerceViewMatomoProperties).categoryName,\n (properties as SetEcommerceViewMatomoProperties).price,\n ];\n break;\n\n /**\n * @description Adds a product into the ecommerce order. Must be called for each product in\n * the order.\n *\n * @link https://matomo.org/docs/ecommerce-analytics/#tracking-ecommerce-orders-items-purchased-required\n * @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce\n *\n * @property productSKU (required) SKU: Product unique identifier\n * @property productName (optional) Product name\n * @property categoryName (optional) Product category, or array of up to 5 categories\n * @property price (recommended) Product price\n * @property quantity (optional, default to 1) Product quantity\n */\n case 'addEcommerceItem':\n params = [\n 'addEcommerceItem',\n (properties as AddEcommerceItemProperties).productSKU,\n (properties as AddEcommerceItemProperties).productName,\n (properties as AddEcommerceItemProperties).productCategory,\n (properties as AddEcommerceItemProperties).price,\n (properties as AddEcommerceItemProperties).quantity,\n ];\n break;\n\n /**\n * @description Tracks a shopping cart. Call this javascript function every time a user is\n * adding, updating or deleting a product from the cart.\n *\n * @link https://matomo.org/docs/ecommerce-analytics/#tracking-add-to-cart-items-added-to-the-cart-optional\n * @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce\n *\n * @property grandTotal (required) Cart amount\n */\n case 'trackEcommerceCartUpdate':\n params = ['trackEcommerceCartUpdate', (properties as TrackEcommerceCartUpdateMatomoProperties).grandTotal];\n break;\n\n /**\n * @description Tracks an Ecommerce order, including any ecommerce item previously added to\n * the order. orderId and grandTotal (ie. revenue) are required parameters.\n *\n * @link https://matomo.org/docs/ecommerce-analytics/#tracking-ecommerce-orders-items-purchased-required\n * @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce\n *\n * @property orderId (required) Unique Order ID\n * @property grandTotal (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)\n * @property subTotal (optional) Order sub total (excludes shipping)\n * @property tax (optional) Tax amount\n * @property shipping (optional) Shipping amount\n * @property discount (optional) Discount offered (set to false for unspecified parameter)\n */\n case 'trackEcommerceOrder':\n params = [\n 'trackEcommerceOrder',\n (properties as TrackEcommerceOrderMatomoProperties).orderId,\n (properties as TrackEcommerceOrderMatomoProperties).grandTotal,\n (properties as TrackEcommerceOrderMatomoProperties).subTotal,\n (properties as TrackEcommerceOrderMatomoProperties).tax,\n (properties as TrackEcommerceOrderMatomoProperties).shipping,\n (properties as TrackEcommerceOrderMatomoProperties).discount,\n ];\n break;\n\n /**\n * @description To manually trigger an outlink\n *\n * @link https://matomo.org/docs/tracking-goals-web-analytics/\n * @link https://developer.matomo.org/guides/tracking-javascript-guide#tracking-a-click-as-an-outlink-via-css-or-javascript\n *\n * @property url (required) link url\n * @property linkType (optional) type of link\n */\n case 'trackLink':\n params = [\n 'trackLink',\n (properties as TrackLinkMatomoProperties).url,\n (properties as TrackLinkMatomoProperties).linkType\n ];\n break;\n\n /**\n * @description Tracks an Ecommerce goal\n *\n * @link https://matomo.org/docs/tracking-goals-web-analytics/\n * @link https://developer.matomo.org/guides/tracking-javascript-guide#manually-trigger-goal-conversions\n *\n * @property goalId (required) Unique Goal ID\n * @property value (optional) passed to goal tracking\n */\n case 'trackGoal':\n params = [\n 'trackGoal',\n (properties as TrackGoalMatomoProperties).goalId,\n (properties as TrackGoalMatomoProperties).value,\n ];\n break;\n\n /**\n * @description Tracks a site search\n *\n * @link https://matomo.org/docs/site-search/\n * @link https://developer.matomo.org/guides/tracking-javascript-guide#internal-search-tracking\n *\n * @property keyword (required) Keyword searched for\n * @property category (optional) Search category\n * @property searchCount (optional) Number of results\n */\n case 'trackSiteSearch':\n params = [\n 'trackSiteSearch',\n (properties as TrackSiteSearchMatomoProperties).keyword,\n (properties as TrackSiteSearchMatomoProperties).category,\n (properties as TrackSiteSearchMatomoProperties).searchCount,\n ];\n break;\n\n /**\n * @description Logs an event with an event category (Videos, Music, Games...), an event\n * action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...), and an optional\n * event name and optional numeric value.\n *\n * @link https://matomo.org/docs/event-tracking/\n * @link https://developer.matomo.org/api-reference/tracking-javascript#using-the-tracker-object\n *\n * @property category\n * @property action\n * @property name (optional, recommended)\n * @property value (optional)\n */\n default:\n // PAQ requires that eventValue be an integer, see: http://matomo.org/docs/event-tracking\n if ((properties as TrackEventMatomoProperties).value) {\n const parsed = parseInt((properties as TrackEventMatomoProperties).value as any, 10);\n (properties as TrackEventMatomoProperties).value = isNaN(parsed) ? 0 : parsed;\n }\n\n params = [\n 'trackEvent',\n (properties as TrackEventMatomoProperties).category,\n action,\n (properties as TrackEventMatomoProperties).name || (properties as TrackEventMatomoProperties).label, // Changed in favour of Matomo documentation. Added fallback so it's backwards compatible.\n (properties as TrackEventMatomoProperties).value,\n ];\n }\n try {\n _paq.push(params);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n setUsername(userId: string | boolean) {\n try {\n _paq.push(['setUserId', userId]);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n /**\n * Sets custom dimensions if at least one property has the key \"dimension<n>\",\n * e.g. dimension10. If there are custom dimensions, any other property is ignored.\n *\n * If there are no custom dimensions in the given properties object, the properties\n * object is saved as a custom variable.\n *\n * If in doubt, prefer custom dimensions.\n * @link https://matomo.org/docs/custom-variables/\n */\n setUserProperties(properties: SetCustomVariableMatomoProperties) {\n const dimensions = this.setCustomDimensions(properties);\n try {\n if (dimensions.length === 0) {\n _paq.push(['setCustomVariable', properties.index, properties.name, properties.value, properties.scope]);\n }\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n /**\n * If you created a custom variable and then decide to remove this variable from \n * a visit or page view, you can use deleteCustomVariable.\n *\n * @link https://developer.matomo.org/guides/tracking-javascript-guide#deleting-a-custom-variable\n */\n deletedUserProperties(properties: DeleteCustomVariableMatomoProperties) {\n try {\n _paq.push(['deleteCustomVariable', properties.index, properties.scope]);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n private setCustomDimensions(properties: SetCustomVariableMatomoProperties): string[] {\n const dimensionRegex: RegExp = /dimension[1-9]\\d*/;\n const dimensions = Object.keys(properties)\n .filter(key => dimensionRegex.exec(key));\n dimensions.forEach(dimension => {\n const number = Number(dimension.substr(9));\n _paq.push(['setCustomDimension', number, properties[dimension]]);\n });\n return dimensions;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './matomo';\n"],"names":["Injectable","Angulartics2"],"mappings":";;;;;;;QAoIE,4BAAoB,YAA0B;YAA9C,iBAQC;YARmB,iBAAY,GAAZ,YAAY,CAAc;YAC5C,IAAI,QAAQ,IAAI,CAAC,KAAK,WAAW,EAAE;gBACjC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;aAClC;YACD,IAAI,CAAC,YAAY,CAAC,WAAW;iBAC1B,SAAS,CAAC,UAAC,CAAS,IAAK,OAAA,KAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;YACjD,IAAI,CAAC,YAAY,CAAC,iBAAiB;iBAChC,SAAS,CAAC,UAAC,CAAoC,IAAK,OAAA,KAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;SACnF;QAED,0CAAa,GAAb;YAAA,iBAOC;YANC,IAAI,CAAC,YAAY,CAAC,SAAS;iBACxB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;iBAC7C,SAAS,CAAC,UAAC,CAAC,IAAK,OAAA,KAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAA,CAAC,CAAC;YAC5C,IAAI,CAAC,YAAY,CAAC,UAAU;iBACzB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;iBAC7C,SAAS,CAAC,UAAC,CAAC,IAAK,OAAA,KAAI,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,CAAC,GAAA,CAAC,CAAC;SAC9D;QAED,sCAAS,GAAT,UAAU,IAAY,EAAE,KAAc;YACpC,IAAI;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sB,UAAgD;YACpE,IAAI;gBACF,IAAI,CAAC,IAAI,CAAC,CAAC,sBAAsB,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;aACzE;YAAC,OAAO,CAAC,EAAE;gBACV,IAAI,EAAE,CAAC,YAAY,cAAc,CAAC,EAAE;oBAClC,MAAM,CAAC,CAAC;iBACT;aACF;SACF;QAEO,gDAAmB,GAAnB,UAAoB,UAA6C;YACvE,IAAM,cAAc,GAAW,mBAAmB,CAAC;YACnD,IAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;iBACvC,MAAM,CAAC,UAAA,GAAG,IAAI,OAAA,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,GAAA,CAAC,CAAC;YAC3C,UAAU,CAAC,OAAO,CAAC,UAAA,SAAS;gBAC1B,IAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC3C,IAAI,CAAC,IAAI,CAAC,CAAC,oBAAoB,EAAE,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;aAClE,CAAC,CAAC;YACH,OAAO,UAAU,CAAC;SACnB;;;;;gBA7SFA,aAAU,SAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;gBA/HzBC,eAAY;;;ICFrB;;;;;;;;;;;;;;"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("angulartics2")):"function"==typeof define&&define.amd?define("angulartics2/matomo",["exports","@angular/core","angulartics2"],t):t(((e=e||self).angulartics2=e.angulartics2||{},e.angulartics2.matomo={}),e.ng.core,e.angulartics2)}(this,(function(e,t,r){"use strict";var o=function(){function e(e){var t=this;this.angulartics2=e,"undefined"==typeof _paq&&console.warn("Matomo not found"),this.angulartics2.setUsername.subscribe((function(e){return t.setUsername(e)})),this.angulartics2.setUserProperties.subscribe((function(e){return t.setUserProperties(e)}))}return e.prototype.startTracking=function(){var e=this;this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe((function(t){return e.pageTrack(t.path)})),this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe((function(t){return e.eventTrack(t.action,t.properties)}))},e.prototype.pageTrack=function(e,t){try{window.location.origin||(window.location.origin=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")),_paq.push(["setDocumentTitle",t||window.document.title]),_paq.push(["setCustomUrl",window.location.origin+e]),_paq.push(["trackPageView"])}catch(e){if(!(e instanceof ReferenceError))throw e}},e.prototype.resetUser=function(){try{_paq.push(["appendToTrackingUrl","new_visit=1"]),_paq.push(["deleteCookies"])}catch(e){if(!(e instanceof ReferenceError))throw e}},e.prototype.eventTrack=function(e,t){var r=[];switch(e){case"setEcommerceView":r=["setEcommerceView",t.productSKU,t.productName,t.categoryName,t.price];break;case"addEcommerceItem":r=["addEcommerceItem",t.productSKU,t.productName,t.productCategory,t.price,t.quantity];break;case"trackEcommerceCartUpdate":r=["trackEcommerceCartUpdate",t.grandTotal];break;case"trackEcommerceOrder":r=["trackEcommerceOrder",t.orderId,t.grandTotal,t.subTotal,t.tax,t.shipping,t.discount];break;case"trackLink":r=["trackLink",t.url,t.linkType];break;case"trackGoal":r=["trackGoal",t.goalId,t.value];break;case"trackSiteSearch":r=["trackSiteSearch",t.keyword,t.category,t.searchCount];break;default:if(t.value){var o=parseInt(t.value,10);t.value=isNaN(o)?0:o}r=["trackEvent",t.category,e,t.name||t.label,t.value]}try{_paq.push(r)}catch(e){if(!(e instanceof ReferenceError))throw e}},e.prototype.setUsername=function(e){try{_paq.push(["setUserId",e])}catch(e){if(!(e instanceof ReferenceError))throw e}},e.prototype.setUserProperties=function(e){var t=this.setCustomDimensions(e);try{0===t.length&&_paq.push(["setCustomVariable",e.index,e.name,e.value,e.scope])}catch(e){if(!(e instanceof ReferenceError))throw e}},e.prototype.deletedUserProperties=function(e){try{_paq.push(["deleteCustomVariable",e.index,e.scope])}catch(e){if(!(e instanceof ReferenceError))throw e}},e.prototype.setCustomDimensions=function(e){var t=/dimension[1-9]\d*/,r=Object.keys(e).filter((function(e){return t.exec(e)}));return r.forEach((function(t){var r=Number(t.substr(9));_paq.push(["setCustomDimension",r,e[t]])})),r},e}();o.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new o(t.ɵɵinject(r.Angulartics2))},token:o,providedIn:"root"}),o.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],o.ctorParameters=function(){return[{type:r.Angulartics2}]},e.Angulartics2Matomo=o,Object.defineProperty(e,"__esModule",{value:!0})}));
|
2
|
+
//# sourceMappingURL=angulartics2-matomo.umd.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/providers/matomo/matomo.ts"],"names":["Angulartics2Matomo","angulartics2","_this","this","console","warn","setUsername","subscribe","x","setUserProperties","prototype","startTracking","pageTrack","pipe","filterDeveloperMode","path","eventTrack","action","properties","title","window","location","origin","protocol","hostname","port","_paq","push","document","e","ReferenceError","resetUser","params","productSKU","productName","categoryName","price","productCategory","quantity","grandTotal","orderId","subTotal","tax","shipping","discount","url","linkType","goalId","value","keyword","category","searchCount","parsed","parseInt","isNaN","name","label","userId","dimensions","setCustomDimensions","length","index","scope","deletedUserProperties","dimensionRegex","Object","keys","filter","key","exec","forEach","dimension","number","Number","substr","Injectable","args","providedIn","Angulartics2"],"mappings":"yYAoIE,SAAAA,EAAoBC,GAApB,IAAAC,EAAAC,KAAoBA,KAAAF,aAAAA,EACI,oBAAlB,MACFG,QAAQC,KAAK,oBAEfF,KAAKF,aAAaK,YACfC,WAAU,SAACC,GAAc,OAAAN,EAAKI,YAAYE,MAC7CL,KAAKF,aAAaQ,kBACfF,WAAU,SAACC,GAAyC,OAAAN,EAAKO,kBAAkBD,aAGhFR,EAAAU,UAAAC,cAAA,WAAA,IAAAT,EAAAC,KACE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,EAAeK,KAAKD,MAKrC,OAJAV,EAAWY,SAAQ,SAAAC,GACjB,IAAMC,EAASC,OAAOF,EAAUG,OAAO,IACvChD,KAAKC,KAAK,CAAC,qBAAsB6C,EAAQtD,EAAWqD,QAE/Cb,mJA5SViB,EAAAA,WAAUC,KAAA,CAAC,CAAEC,WAAY,oDA/HjBC,EAAAA","sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { Angulartics2 } from 'angulartics2';\n\ndeclare var _paq: any;\n\nexport type EventTrackAction = 'setEcommerceView' | 'addEcommerceItem' | 'trackEcommerceCartUpdate'\n | 'trackEcommerceOrder' | 'trackLink' | 'trackGoal' | 'trackSiteSearch' | string;\n\nexport type ScopeMatomo = 'visit' | 'page';\n\n\nexport interface DimensionsMatomoProperties {\n dimension0?: string;\n dimension1?: string;\n dimension2?: string;\n dimension3?: string;\n dimension4?: string;\n dimension5?: string;\n dimension6?: string;\n dimension7?: string;\n dimension8?: string;\n dimension9?: string;\n}\nexport interface SetEcommerceViewMatomoProperties {\n /** @class SetEcommerceViewMatomoProperties */\n productSKU: string;\n /** @class SetEcommerceViewMatomoProperties */\n productName: string;\n /** @class SetEcommerceViewMatomoProperties */\n categoryName: string;\n /** @class SetEcommerceViewMatomoProperties */\n price: string;\n}\n\nexport interface AddEcommerceItemProperties {\n /** @class AddEcommerceItemProperties */\n productSKU: string;\n /** @class AddEcommerceItemProperties */\n productName: string;\n /** @class AddEcommerceItemProperties */\n productCategory: string;\n /** @class AddEcommerceItemProperties */\n price: string;\n /** @class AddEcommerceItemProperties */\n quantity: string;\n}\n\nexport interface TrackEcommerceCartUpdateMatomoProperties {\n /** @class TrackEcommerceCartUpdateMatomoProperties */\n grandTotal: string;\n}\n\nexport interface TrackEcommerceOrderMatomoProperties {\n /** @class TrackEcommerceOrderMatomoProperties */\n orderId: string;\n /** @class TrackEcommerceOrderMatomoProperties */\n grandTotal: string;\n /** @class TrackEcommerceOrderMatomoProperties */\n subTotal: string;\n /** @class TrackEcommerceOrderMatomoProperties */\n tax: string;\n /** @class TrackEcommerceOrderMatomoProperties */\n shipping: string;\n /** @class TrackEcommerceOrderMatomoProperties */\n discount: string;\n}\n\nexport interface TrackLinkMatomoProperties {\n /** @class TrackLinkMatomoProperties */\n url: string;\n /** @class TrackLinkMatomoProperties */\n linkType: string;\n}\n\nexport interface TrackGoalMatomoProperties {\n /** @class TrackGoalMatomoProperties */\n goalId: string;\n /** @class TrackGoalMatomoProperties */\n value: string;\n}\n\nexport interface TrackSiteSearchMatomoProperties {\n /** @class TrackSiteSearchMatomoProperties */\n keyword: string;\n /** @class TrackSiteSearchMatomoProperties */\n category: string;\n /** @class TrackSiteSearchMatomoProperties */\n searchCount: string;\n}\n\nexport interface TrackEventMatomoProperties {\n /** @class TrackEventMatomoProperties */\n category: string;\n /** @class TrackEventMatomoProperties */\n name?: string;\n /** @class TrackEventMatomoProperties */\n label?: string;\n /** @class TrackEventMatomoProperties */\n value: number | string;\n}\n\nexport interface SetCustomVariableMatomoProperties extends DimensionsMatomoProperties {\n /** @class SetCustomVariableMatomoProperties */\n index: number;\n /** @class SetCustomVariableMatomoProperties */\n name: string;\n /** @class SetCustomVariableMatomoProperties */\n value: string;\n /** @class SetCustomVariableMatomoProperties */\n scope: ScopeMatomo;\n}\n\nexport interface DeleteCustomVariableMatomoProperties {\n /** @class DeleteCustomVariableMatomoProperties */\n index: number;\n /** @class DeleteCustomVariableMatomoProperties */\n scope: ScopeMatomo;\n}\n\nexport type EventTrackactionProperties = SetEcommerceViewMatomoProperties\n | AddEcommerceItemProperties\n | TrackEcommerceCartUpdateMatomoProperties\n | TrackEcommerceOrderMatomoProperties\n | TrackLinkMatomoProperties\n | TrackGoalMatomoProperties\n | TrackSiteSearchMatomoProperties\n | TrackEventMatomoProperties;\n\n@Injectable({ providedIn: 'root' })\nexport class Angulartics2Matomo {\n\n constructor(private angulartics2: Angulartics2) {\n if (typeof (_paq) === 'undefined') {\n console.warn('Matomo not found');\n }\n this.angulartics2.setUsername\n .subscribe((x: string) => this.setUsername(x));\n this.angulartics2.setUserProperties\n .subscribe((x: SetCustomVariableMatomoProperties) => this.setUserProperties(x));\n }\n\n startTracking(): void {\n this.angulartics2.pageTrack\n .pipe(this.angulartics2.filterDeveloperMode())\n .subscribe((x) => this.pageTrack(x.path));\n this.angulartics2.eventTrack\n .pipe(this.angulartics2.filterDeveloperMode())\n .subscribe((x) => this.eventTrack(x.action, x.properties));\n }\n\n pageTrack(path: string, title?: string) {\n try {\n if (!window.location.origin) {\n (window.location as any).origin = window.location.protocol + '//'\n + window.location.hostname\n + (window.location.port ? ':' + window.location.port : '');\n }\n _paq.push(['setDocumentTitle', title || window.document.title]);\n _paq.push(['setCustomUrl', window.location.origin + path]);\n _paq.push(['trackPageView']);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n resetUser() {\n try {\n _paq.push(['appendToTrackingUrl', 'new_visit=1']); // (1) forces a new visit\n _paq.push(['deleteCookies']); // (2) deletes existing tracking cookies to start the new visit\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n eventTrack(action: 'setEcommerceView', properties: SetEcommerceViewMatomoProperties): void;\n eventTrack(action: 'addEcommerceItem', properties: AddEcommerceItemProperties): void;\n eventTrack(action: 'trackEcommerceCartUpdate', properties: TrackEcommerceCartUpdateMatomoProperties): void;\n eventTrack(action: 'trackEcommerceOrder', properties: TrackEcommerceOrderMatomoProperties): void;\n eventTrack(action: 'trackLink', properties: TrackLinkMatomoProperties): void;\n eventTrack(action: 'trackGoal', properties: TrackGoalMatomoProperties): void;\n eventTrack(action: 'trackSiteSearch', properties: TrackSiteSearchMatomoProperties): void;\n eventTrack(action: string, properties: TrackEventMatomoProperties): void;\n\n /**\n * Track a basic event in Matomo, or send an ecommerce event.\n *\n * @param action A string corresponding to the type of event that needs to be tracked.\n * @param properties The properties that need to be logged with the event.\n */\n eventTrack(action: EventTrackAction, properties?: EventTrackactionProperties) {\n let params = [];\n switch (action) {\n /**\n * @description Sets the current page view as a product or category page view. When you call\n * setEcommerceView it must be followed by a call to trackPageView to record the product or\n * category page view.\n *\n * @link https://matomo.org/docs/ecommerce-analytics/#tracking-product-page-views-category-page-views-optional\n * @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce\n *\n * @property productSKU (required) SKU: Product unique identifier\n * @property productName (optional) Product name\n * @property categoryName (optional) Product category, or array of up to 5 categories\n * @property price (optional) Product Price as displayed on the page\n */\n case 'setEcommerceView':\n params = ['setEcommerceView',\n (properties as SetEcommerceViewMatomoProperties).productSKU,\n (properties as SetEcommerceViewMatomoProperties).productName,\n (properties as SetEcommerceViewMatomoProperties).categoryName,\n (properties as SetEcommerceViewMatomoProperties).price,\n ];\n break;\n\n /**\n * @description Adds a product into the ecommerce order. Must be called for each product in\n * the order.\n *\n * @link https://matomo.org/docs/ecommerce-analytics/#tracking-ecommerce-orders-items-purchased-required\n * @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce\n *\n * @property productSKU (required) SKU: Product unique identifier\n * @property productName (optional) Product name\n * @property categoryName (optional) Product category, or array of up to 5 categories\n * @property price (recommended) Product price\n * @property quantity (optional, default to 1) Product quantity\n */\n case 'addEcommerceItem':\n params = [\n 'addEcommerceItem',\n (properties as AddEcommerceItemProperties).productSKU,\n (properties as AddEcommerceItemProperties).productName,\n (properties as AddEcommerceItemProperties).productCategory,\n (properties as AddEcommerceItemProperties).price,\n (properties as AddEcommerceItemProperties).quantity,\n ];\n break;\n\n /**\n * @description Tracks a shopping cart. Call this javascript function every time a user is\n * adding, updating or deleting a product from the cart.\n *\n * @link https://matomo.org/docs/ecommerce-analytics/#tracking-add-to-cart-items-added-to-the-cart-optional\n * @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce\n *\n * @property grandTotal (required) Cart amount\n */\n case 'trackEcommerceCartUpdate':\n params = ['trackEcommerceCartUpdate', (properties as TrackEcommerceCartUpdateMatomoProperties).grandTotal];\n break;\n\n /**\n * @description Tracks an Ecommerce order, including any ecommerce item previously added to\n * the order. orderId and grandTotal (ie. revenue) are required parameters.\n *\n * @link https://matomo.org/docs/ecommerce-analytics/#tracking-ecommerce-orders-items-purchased-required\n * @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce\n *\n * @property orderId (required) Unique Order ID\n * @property grandTotal (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)\n * @property subTotal (optional) Order sub total (excludes shipping)\n * @property tax (optional) Tax amount\n * @property shipping (optional) Shipping amount\n * @property discount (optional) Discount offered (set to false for unspecified parameter)\n */\n case 'trackEcommerceOrder':\n params = [\n 'trackEcommerceOrder',\n (properties as TrackEcommerceOrderMatomoProperties).orderId,\n (properties as TrackEcommerceOrderMatomoProperties).grandTotal,\n (properties as TrackEcommerceOrderMatomoProperties).subTotal,\n (properties as TrackEcommerceOrderMatomoProperties).tax,\n (properties as TrackEcommerceOrderMatomoProperties).shipping,\n (properties as TrackEcommerceOrderMatomoProperties).discount,\n ];\n break;\n\n /**\n * @description To manually trigger an outlink\n *\n * @link https://matomo.org/docs/tracking-goals-web-analytics/\n * @link https://developer.matomo.org/guides/tracking-javascript-guide#tracking-a-click-as-an-outlink-via-css-or-javascript\n *\n * @property url (required) link url\n * @property linkType (optional) type of link\n */\n case 'trackLink':\n params = [\n 'trackLink',\n (properties as TrackLinkMatomoProperties).url,\n (properties as TrackLinkMatomoProperties).linkType\n ];\n break;\n\n /**\n * @description Tracks an Ecommerce goal\n *\n * @link https://matomo.org/docs/tracking-goals-web-analytics/\n * @link https://developer.matomo.org/guides/tracking-javascript-guide#manually-trigger-goal-conversions\n *\n * @property goalId (required) Unique Goal ID\n * @property value (optional) passed to goal tracking\n */\n case 'trackGoal':\n params = [\n 'trackGoal',\n (properties as TrackGoalMatomoProperties).goalId,\n (properties as TrackGoalMatomoProperties).value,\n ];\n break;\n\n /**\n * @description Tracks a site search\n *\n * @link https://matomo.org/docs/site-search/\n * @link https://developer.matomo.org/guides/tracking-javascript-guide#internal-search-tracking\n *\n * @property keyword (required) Keyword searched for\n * @property category (optional) Search category\n * @property searchCount (optional) Number of results\n */\n case 'trackSiteSearch':\n params = [\n 'trackSiteSearch',\n (properties as TrackSiteSearchMatomoProperties).keyword,\n (properties as TrackSiteSearchMatomoProperties).category,\n (properties as TrackSiteSearchMatomoProperties).searchCount,\n ];\n break;\n\n /**\n * @description Logs an event with an event category (Videos, Music, Games...), an event\n * action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...), and an optional\n * event name and optional numeric value.\n *\n * @link https://matomo.org/docs/event-tracking/\n * @link https://developer.matomo.org/api-reference/tracking-javascript#using-the-tracker-object\n *\n * @property category\n * @property action\n * @property name (optional, recommended)\n * @property value (optional)\n */\n default:\n // PAQ requires that eventValue be an integer, see: http://matomo.org/docs/event-tracking\n if ((properties as TrackEventMatomoProperties).value) {\n const parsed = parseInt((properties as TrackEventMatomoProperties).value as any, 10);\n (properties as TrackEventMatomoProperties).value = isNaN(parsed) ? 0 : parsed;\n }\n\n params = [\n 'trackEvent',\n (properties as TrackEventMatomoProperties).category,\n action,\n (properties as TrackEventMatomoProperties).name || (properties as TrackEventMatomoProperties).label, // Changed in favour of Matomo documentation. Added fallback so it's backwards compatible.\n (properties as TrackEventMatomoProperties).value,\n ];\n }\n try {\n _paq.push(params);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n setUsername(userId: string | boolean) {\n try {\n _paq.push(['setUserId', userId]);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n /**\n * Sets custom dimensions if at least one property has the key \"dimension<n>\",\n * e.g. dimension10. If there are custom dimensions, any other property is ignored.\n *\n * If there are no custom dimensions in the given properties object, the properties\n * object is saved as a custom variable.\n *\n * If in doubt, prefer custom dimensions.\n * @link https://matomo.org/docs/custom-variables/\n */\n setUserProperties(properties: SetCustomVariableMatomoProperties) {\n const dimensions = this.setCustomDimensions(properties);\n try {\n if (dimensions.length === 0) {\n _paq.push(['setCustomVariable', properties.index, properties.name, properties.value, properties.scope]);\n }\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n /**\n * If you created a custom variable and then decide to remove this variable from \n * a visit or page view, you can use deleteCustomVariable.\n *\n * @link https://developer.matomo.org/guides/tracking-javascript-guide#deleting-a-custom-variable\n */\n deletedUserProperties(properties: DeleteCustomVariableMatomoProperties) {\n try {\n _paq.push(['deleteCustomVariable', properties.index, properties.scope]);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n private setCustomDimensions(properties: SetCustomVariableMatomoProperties): string[] {\n const dimensionRegex: RegExp = /dimension[1-9]\\d*/;\n const dimensions = Object.keys(properties)\n .filter(key => dimensionRegex.exec(key));\n dimensions.forEach(dimension => {\n const number = Number(dimension.substr(9));\n _paq.push(['setCustomDimension', number, properties[dimension]]);\n });\n return dimensions;\n }\n}\n"]}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* Generated bundle index. Do not edit.
|
3
|
+
*/
|
4
|
+
export * from './matomo';
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhcnRpY3MyLW1hdG9tby5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvcHJvdmlkZXJzL21hdG9tby9hbmd1bGFydGljczItbWF0b21vLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxVQUFVLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vbWF0b21vJztcbiJdfQ==
|