From b1759f6710de5ae7c6d29b15bed56601ef906b4d Mon Sep 17 00:00:00 2001
From: Eugen Neuber <eugen.neuber@tugraz.at>
Date: Wed, 16 Sep 2020 11:39:28 +0200
Subject: [PATCH] Setup Matomo only with endpoint url and site id

See issue #29
---
 packages/matomo/src/matomo.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/packages/matomo/src/matomo.js b/packages/matomo/src/matomo.js
index 6365082f..4e69ec6d 100644
--- a/packages/matomo/src/matomo.js
+++ b/packages/matomo/src/matomo.js
@@ -41,6 +41,14 @@ export class MatomoElement extends DBPLitElement {
 
     setupMatomo(loggedIn) {
         if (loggedIn && ! this.isRunning) {
+            if (this.siteId === -1) {
+                console.log('site id missing, skipping matomo...');
+                return;
+            }
+            if (this.endpoint === '') {
+                console.log('endpoint missing, skipping matomo...');
+                return;
+            }
             console.log('add matomo...');
 
             window._paq = window._paq || [];
-- 
GitLab