From 1af3d022e49a892f217006e58ab7469c1ec578f5 Mon Sep 17 00:00:00 2001
From: Patrizio Bekerle <patrizio.bekerle@tugraz.at>
Date: Tue, 28 Jan 2020 14:04:03 +0100
Subject: [PATCH] Add Matomo error tracking

---
 packages/common/error.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/packages/common/error.js b/packages/common/error.js
index e884bb4a..34a192f0 100644
--- a/packages/common/error.js
+++ b/packages/common/error.js
@@ -39,6 +39,10 @@ export const handleXhrError = (jqXHR, textStatus, errorThrown, icon = "sad") =>
         "icon": icon,
         "type": "danger",
     });
+
+    if (_paq !== undefined) {
+        _paq.push(['trackEvent', 'XhrError', body]);
+    }
 };
 
 /**
@@ -84,4 +88,8 @@ export const handleFetchError = async (error, summary = "", icon = "sad") => {
         "icon": icon,
         "type": "danger",
     });
+
+    if (_paq !== undefined) {
+        _paq.push(['trackEvent', 'FetchError', summary === "" ? body : summary + ": " + body]);
+    }
 };
-- 
GitLab