From e32b24848fa7e7072300e037502c4e7af5dbc77c Mon Sep 17 00:00:00 2001 From: Set Hallstrom Date: Mon, 30 Nov 2020 17:04:09 +0100 Subject: [PATCH] enable cross domain tracking --- _includes/analytics.js | 40 ++++++++++++++++++++-------------------- _includes/matomo.js | 8 +++++--- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/_includes/analytics.js b/_includes/analytics.js index 1b0c4b6..77e1c70 100644 --- a/_includes/analytics.js +++ b/_includes/analytics.js @@ -2,31 +2,31 @@ //* Matomo *// - var _paq = window._paq || []; - /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ - _paq.push(['setDocumentTitle', '404/URL = ' + encodeURIComponent(document.location.pathname+document.location.search) + '/From = ' + encodeURIComponent(document.referrer)]); - _paq.push(['disableCookies']); - _paq.push(['trackPageView']); - _paq.push(['enableLinkTracking']); - (function() { - var u="https://terminalnetwork.matomo.cloud/"; - _paq.push(['setTrackerUrl', u+'matomo.php']); - _paq.push(['setSiteId', '{{ site.matomo_site_id }}']); - var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.type='text/javascript'; g.async=true; g.defer=true; g.src='https://cdn.matomo.cloud/terminalnetwork.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s); - })(); - +var _paq = window._paq = window._paq || []; +/* tracker methods like "setCustomDimension" should be called before "trackPageView" */ +_paq.push(['setDocumentTitle', '404/URL = ' + encodeURIComponent(document.location.pathname+document.location.search) + '/From = ' + encodeURIComponent(document.referrer)]); +_paq.push(["setCookieDomain", "*.basspistol.org"]); +_paq.push(["setDomains", ["*.basspistol.org","*.basspistol.com","*.pauvrecoude.basspistol.com","*.paxnion.basspistol.com","*.radio.basspistol.com","*.sakrecoer.basspistol.com","*.sakrecoer.com","*.sethybowoy.basspistol.com","*.setto.basspistol.com","*.tfb.basspistol.com","*.v.basspistol.org"]]); +_paq.push(["enableCrossDomainLinking"]); +_paq.push(["disableCookies"]); +_paq.push(['trackPageView']); +_paq.push(['enableLinkTracking']); +(function() { + var u="https://terminalnetwork.matomo.cloud/"; + _paq.push(['setTrackerUrl', u+'matomo.php']); + _paq.push(['setSiteId', '{{ site.matomo_site_id }}']); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.type='text/javascript'; g.async=true; g.src='https://cdn.matomo.cloud/terminalnetwork.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s); +})(); //* End Matomo *// - - {% else %} //* Matomo Tag Manager *// - var _mtm = _mtm || []; - _mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'}); - var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.type='text/javascript'; g.async=true; g.defer=true; g.src='https://cdn.matomo.cloud/terminalnetwork.matomo.cloud/container_{{ site.matomo_container }}.js'; s.parentNode.insertBefore(g,s); +var _mtm = window._mtm = window._mtm || []; +_mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'}); +var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; +g.type='text/javascript'; g.async=true; g.src='https://cdn.matomo.cloud/terminalnetwork.matomo.cloud/container_{{ site.matomo_container }}.js'; s.parentNode.insertBefore(g,s); //* End Matomo Tag Manager *// {% endif %} diff --git a/_includes/matomo.js b/_includes/matomo.js index 214bac0..d02d365 100644 --- a/_includes/matomo.js +++ b/_includes/matomo.js @@ -1,6 +1,8 @@ -var _paq = window._paq || []; -/* tracker methods like "setCustomDimension" should be called before "trackPageView" */ +var _paq = window._paq = window._paq || []; _paq.push(["setDocumentTitle", document.domain + "/" + document.title]); +_paq.push(["setCookieDomain", "*.basspistol.org"]); +_paq.push(["setDomains", ["*.basspistol.org","*.basspistol.com","*.pauvrecoude.basspistol.com","*.paxnion.basspistol.com","*.radio.basspistol.com","*.sakrecoer.basspistol.com","*.sakrecoer.com","*.sethybowoy.basspistol.com","*.setto.basspistol.com","*.tfb.basspistol.com","*.v.basspistol.org"]]); +_paq.push(["enableCrossDomainLinking"]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); @@ -9,5 +11,5 @@ _paq.push(['enableLinkTracking']); _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '{{ site.matomo_site_id }}']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.type='text/javascript'; g.async=true; g.defer=true; g.src='https://cdn.matomo.cloud/terminalnetwork.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s); + g.type='text/javascript'; g.async=true; g.src='https://cdn.matomo.cloud/terminalnetwork.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s); })();