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

Prevent Matomo complaining about empty action

parent af591350
No related branches found
No related tags found
No related merge requests found
Pipeline #22666 passed
...@@ -164,8 +164,14 @@ export class MatomoElement extends DBPLitElement { ...@@ -164,8 +164,14 @@ export class MatomoElement extends DBPLitElement {
pushEvent(event) { pushEvent(event) {
window._paq = window._paq || []; window._paq = window._paq || [];
// make sure the event action is a non-empty string
// prevents: "Error while logging event: Parameters `category` and `action` must not be empty or filled with whitespaces"
if (event[1] === null || event[1] === '' || event[1] === undefined) {
event[1] = 'empty';
}
// make sure the event name is a non-empty string // make sure the event name is a non-empty string
if (event[2] === null || event[2] === '') { if (event[2] === null || event[2] === '' || event[2] === undefined) {
event[2] = 'empty'; event[2] = 'empty';
} else if (typeof event[2] === 'object') { } else if (typeof event[2] === 'object') {
event[2] = JSON.stringify(event[2]); event[2] = JSON.stringify(event[2]);
......
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