diff --git a/config.toml b/config.toml index 4d4e665e6..e8949da7c 100644 --- a/config.toml +++ b/config.toml @@ -98,6 +98,10 @@ newsfeed ='https://feed.qgis.org/?lang=en&json=1' ## This will turn on Coockie popup. True to show popup cookiesstate = false +# Matomo +matomoURL = "//matomo.qgis.org/" +matomoSiteId = '6' + # commit hash file commitFile = "config/commit.toml" diff --git a/themes/hugo-bulma-blocks-theme/assets/js/matomo.js b/themes/hugo-bulma-blocks-theme/assets/js/matomo.js new file mode 100644 index 000000000..827f05c54 --- /dev/null +++ b/themes/hugo-bulma-blocks-theme/assets/js/matomo.js @@ -0,0 +1,12 @@ +var _paq = window._paq = window._paq || []; +/* tracker methods like "setCustomDimension" should be called before "trackPageView" */ +_paq.push(["disableCookies"]); +_paq.push(['trackPageView']); +_paq.push(['enableLinkTracking']); +(function() { + var u=matomoURL; + _paq.push(['setTrackerUrl', u+'matomo.php']); + _paq.push(['setSiteId', matomoSiteId]); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); +})(); \ No newline at end of file diff --git a/themes/hugo-bulma-blocks-theme/layouts/partials/header.html b/themes/hugo-bulma-blocks-theme/layouts/partials/header.html index 98c48e3ed..7dfc562ff 100644 --- a/themes/hugo-bulma-blocks-theme/layouts/partials/header.html +++ b/themes/hugo-bulma-blocks-theme/layouts/partials/header.html @@ -145,6 +145,10 @@ {{/* QR Encoding Logic */}} {{ $qrencodejs := resources.Get "js/qrcodegen-v1.8.0-es6.js"| resources.Minify | resources.Fingerprint }} + {{/* Homegrown JS functions */}} {{ $expandjs := resources.Get "js/card-expand.js" }} @@ -153,11 +157,12 @@ {{ $qrcreatejs := resources.Get "js/qrcreate.js" }} {{ $fusejs := resources.Get "js/fuse.js" }} {{ $markjs := resources.Get "js/mark.min.js" }} + {{ $matomojs := resources.Get "js/matomo.js" }} {{/* See https://www.youtube.com/watch?v=T33NN_pPeNI */}} - {{ $js := slice $animatejs $expandjs $navbarjs $qrcreatejs $fusejs $markjs | resources.Concat "js/all.js" | resources.Minify | resources.Fingerprint }} + {{ $js := slice $animatejs $expandjs $navbarjs $qrcreatejs $fusejs $markjs $matomojs | resources.Concat "js/all.js" | resources.Minify | resources.Fingerprint }} {{ if (eq .Site.Params.cookiesstate true) }} {{ $cookiejs := resources.Get "js/cookie.js" }} - {{ $js = slice $animatejs $expandjs $navbarjs $qrcreatejs $fusejs $markjs $cookiejs | resources.Concat "js/all.js" | resources.Minify | resources.Fingerprint }} + {{ $js = slice $animatejs $expandjs $navbarjs $qrcreatejs $fusejs $markjs $matomojs $cookiejs | resources.Concat "js/all.js" | resources.Minify | resources.Fingerprint }} {{ end }} {{/* Search needs to be rendered as a template to ensure urls are correct */}}