Skip to content
Snippets Groups Projects
Commit 0942162b authored by Neuber, Eugen Ramon's avatar Neuber, Eugen Ramon :speech_balloon:
Browse files

Simplify call to matomo.track()

See issue #29
parent 718300dd
No related branches found
No related tags found
1 merge request!2Matomo web component
Pipeline #13009 passed
......@@ -61,6 +61,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
this.matomoUrl = '';
this.matomoSiteId = -1;
this.matomo = null;
this._attrObserver = new MutationObserver(this.onAttributeObserved);
}
......@@ -255,6 +256,10 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
this.initRouter();
this._bus.subscribe('auth-update', this._updateAuth);
this.updateComplete.then(()=> {
this.matomo = this.shadowRoot.querySelector(this.constructor.getScopedTagName('dbp-matomo'));
});
}
disconnectedCallback() {
......@@ -668,9 +673,8 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
}
track(action, message) {
const matomo = this.shadowRoot.querySelector(this.constructor.getScopedTagName('dbp-matomo'));
if (matomo !== null) {
matomo.track(action, message);
if (this.matomo !== null) {
this.matomo.track(action, message);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment