diff --git a/app/utils/analytics.js b/app/utils/analytics.js index 3cf5222..533c34d 100644 --- a/app/utils/analytics.js +++ b/app/utils/analytics.js @@ -1,9 +1,9 @@ export function analytics(eventData) { if(eventData.value) { - _paq.push(['trackEvent', eventData.category, eventData.action, eventData.name, eventData.value]) + window._paq.push(['trackEvent', eventData.category, eventData.action, eventData.name, eventData.value]) } else { - _paq.push(['trackEvent', eventData.category, eventData.action, eventData.name]) + window._paq.push(['trackEvent', eventData.category, eventData.action, eventData.name]) } } @@ -18,11 +18,11 @@ export function initializeMatomoTagManager(containerID) { // To track pageviews, watching for changes to location.pathname let previousUrlPath = location.pathname; - const observer = new MutationObserver(function(mutations) { + const observer = new MutationObserver(function() { if (location.pathname !== previousUrlPath) { previousUrlPath = location.pathname; - _paq.push(['setCustomUrl', location.href]); - _paq.push(['trackPageView']); + window._paq.push(['setCustomUrl', location.href]); + window._paq.push(['trackPageView']); } }); const config = {subtree: true, childList: true};