NLeSC / guide

Software Development Guide
https://guide.esciencecenter.nl
Creative Commons Attribution 4.0 International
47 stars 30 forks source link

Add Matomo tracking #341

Open egpbos opened 1 month ago

egpbos commented 1 month ago

Following up on the discussion in #161, instead of Google Analytics, we should add Matomo tracking to the Guide. We also use Matomo for the corporate site and for the research software directory.

Veronica referred me to @ewan-escience who was able to give me an account on the RSD Matomo server. To enable Matomo tracking, we need to add a small piece of code in the rendered pages.

However, if we want to track, which uses cookies, we also need a cookie banner. So, two todo items in this issue:

<!-- Matomo -->
<script>
  var _paq = window._paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//matomo.research.software/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '5']);
    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);
  })();
</script>
<!-- End Matomo Code -->
ewan-escience commented 1 month ago

Related to tracking, and in the light of #161, can the data-ga="UA-55088238-8" code and the plugin ga.min.js be removed?`

egpbos commented 1 month ago

I will check whether they still work. I vaguely remember that we didn't update it recently after some old version API went offline. If they do, until we have Matomo, it may still be helpful to keep collecting there.

egpbos commented 1 month ago

GA actually still is working, so let's keep it in for now while we move over to Matomo.

ewan-escience commented 1 week ago

According to the documentation, you can also use Matomo without consent or cookie banner. This does impact the accuracy. We might also need a privacy policy.