From 5cd7a9c63e1784abb67ecd8f9253089f433a3e8b Mon Sep 17 00:00:00 2001 From: sakrecoer Date: Mon, 30 Nov 2020 17:37:02 +0100 Subject: [PATCH] cross stie tracking --- _config.yml | 4 ++++ _includes/analytics.js | 51 ++++++++++++++++++++++++------------------ _includes/matomo.js | 40 +++++++++++++++++++++++++++++---- 3 files changed, 69 insertions(+), 26 deletions(-) diff --git a/_config.yml b/_config.yml index 042b01e..1a80f60 100644 --- a/_config.yml +++ b/_config.yml @@ -44,6 +44,10 @@ social: - https://mastodon.art/@sakrecoer - https://sakrecoer.bandcamp.com/ +## Matomo +matomo_site_id: '3' +matomo_container: 'fHO88MfH' + categories: - releases - ramblings diff --git a/_includes/analytics.js b/_includes/analytics.js index 79cf64e..3194c76 100644 --- a/_includes/analytics.js +++ b/_includes/analytics.js @@ -1,33 +1,40 @@ -{% if page.url == '/404.html' %} +{% if page.url == '/404/' %} //* 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', '4']); - var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.type='text/javascript'; g.async=true; g.defer=true; g.src='//cdn.matomo.cloud/terminalnetwork.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s); - })(); - +var _paq = window._paq = window._paq || []; +_paq.push(['setDocumentTitle', '404/URL = ' + encodeURIComponent(document.location.pathname+document.location.search) + '/From = ' + encodeURIComponent(document.referrer)]); +_paq.push(["setCookieDomain", "*.basspistol.com"]); +_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(['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 _paq = window._paq = window._paq || []; +_paq.push(["setDocumentTitle", document.domain + "/" + document.title]); +_paq.push(["setCookieDomain", "*.basspistol.com"]); +_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(['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/container_sc9z00rL.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); +})(); -//* End Matomo Tag Manager *// {% endif %} diff --git a/_includes/matomo.js b/_includes/matomo.js index cabb1ac..696067c 100644 --- a/_includes/matomo.js +++ b/_includes/matomo.js @@ -1,13 +1,45 @@ -var _paq = window._paq || []; +{% if page.url == '/404/' %} + +//* Matomo *// + +var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ -_paq.push(["setDocumentTitle", document.domain + "/" + document.title]); +_paq.push(['setDocumentTitle', '404/URL = ' + encodeURIComponent(document.location.pathname+document.location.search) + '/From = ' + encodeURIComponent(document.referrer)]); +_paq.push(["setCookieDomain", "*.basspistol.com"]); +_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', '4']); + _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='//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); })(); +//* End Matomo *// + +{% else %} + +//* Matomo *// + +var _paq = window._paq = window._paq || []; +_paq.push(["setDocumentTitle", document.domain + "/" + document.title]); +_paq.push(["setCookieDomain", "*.basspistol.com"]); +_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 *// + +{% endif %} \ No newline at end of file