Skip to content
Snippets Groups Projects
Unverified Commit 20883ddb authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Send Matomo tracking events to "self" instead of parent in the app shell

parent 02bb8d78
No related branches found
No related tags found
No related merge requests found
......@@ -276,7 +276,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
this.router.update();
// tell a dbp-provider to update the "lang" property
this.sendSetPropertyEvent('lang', lang);
this.sendSetPropertyEvent('lang', lang, true);
}
}
......@@ -750,7 +750,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
}
track(action, message) {
this.sendSetPropertyEvent('analytics-event', {'category': action, 'action': message});
this.sendSetPropertyEvent('analytics-event', {'category': action, 'action': message}, true);
}
_renderActivity() {
......
......@@ -307,9 +307,10 @@ export class AdapterLitElement extends LitElement {
*
* @param name
* @param value
* @param sendToSelf Set this to "true" if the event should be sent to oneself instead of the parent (e.g. in the app shell if there isn't a provider around it)
* @returns {boolean}
*/
sendSetPropertyEvent(name, value) {
sendSetPropertyEvent(name, value, sendToSelf = false) {
// Logger.debug("dbp-set-property", name, value);
const event = new CustomEvent('dbp-set-property', {
......@@ -320,7 +321,7 @@ export class AdapterLitElement extends LitElement {
// dispatch the dbp-set-property event to the parent (if there is any) so that the current element
// doesn't terminate the event if it has the attribute set itself
const element = this.parentElement ? this.parentElement : this;
const element = this.parentElement && !sendToSelf ? this.parentElement : this;
return element.dispatchEvent(event);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment