Skip to content

Commit d7a321f

Browse files
committed
theme-cernbox: enable matomo in qa
1 parent b405639 commit d7a321f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

theme-cernbox/custom.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ if (externalLinksRegex.test(window.location.pathname)) {
2020
}
2121
}
2222

23+
const enableMatomo = () => {
24+
var _paq = window._paq = window._paq || [];
25+
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
26+
_paq.push(["setDomains", ["*.cernbox.cern.ch"]]);
27+
_paq.push(['trackPageView']);
28+
_paq.push(['enableLinkTracking']);
29+
(function() {
30+
var u="https://piwikui.web.cern.ch/";
31+
_paq.push(['setTrackerUrl', u+'matomo.php']);
32+
_paq.push(['setSiteId', '8164']);
33+
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
34+
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
35+
})();
36+
}
37+
2338
const root = document.querySelector(":root");
2439

2540
const qaBoxRegex = /^qa\./i;
@@ -29,6 +44,7 @@ const devBoxRegex = /^cbox-ocisdev-([A-z]*)\./i;
2944
if (qaBoxRegex.test(window.location.hostname)) {
3045
root.style.setProperty("--oc-color-swatch-brand-default", "#7F1734");
3146
root.style.setProperty("--oc-color-swatch-brand-hover", "#A01C41");
47+
enableMatomo();
3248
} else if (testBoxRegex.test(window.location.hostname)) {
3349
root.style.setProperty("--oc-color-swatch-brand-default", "#004225");
3450
root.style.setProperty("--oc-color-swatch-brand-hover", "#1E4D2B");

0 commit comments

Comments
 (0)