Skip to content
Snippets Groups Projects

Matomo web component

Merged Neuber, Eugen Ramon requested to merge matomo-component into master
3 unresolved threads
1 file
+ 10
1
Compare changes
  • Side-by-side
  • Inline
@@ -11,6 +11,7 @@ export class MatomoElement extends DBPLitElement {
this.endpoint = '';
this.siteId = -1;
this.isRunning = false;
this.lastEvent = [];
}
@@ -91,6 +92,11 @@ export class MatomoElement extends DBPLitElement {
});
this.isRunning = true;
if (this.lastEvent.length > 0) {
console.log('MatomoElement* (' + this.isRunning + '): ' + this.lastEvent[1] + ', ' + this.lastEvent[2]);
_paq.push(this.lastEvent);
this.lastEvent = [];
}
return;
}
if (! loggedIn && this.isRunning) {
@@ -102,8 +108,11 @@ export class MatomoElement extends DBPLitElement {
track (action, message) {
console.log('MatomoElement (' + this.isRunning + '): ' + action + ', ' + message);
const event = ['trackEvent', action, message];
if (this.isRunning) {
_paq.push(['trackEvent', action, message]);
_paq.push(event);
} else {
this.lastEvent = event;
}
}
}
Loading