gigascience / gigadb-website

Source code for running GigaDB
http://gigadb.org
GNU General Public License v3.0
9 stars 15 forks source link

Add javascript tracker to all pages for analytics #1759

Closed rija closed 7 months ago

rija commented 8 months ago

User Story

As a curator I want to know how visitors use our website So we can serve them better

We have a Matomo account now for analytics. In order for tracking to work we need the following JS script to be added on all pages:

<!-- Matomo -->
<script>
  var _paq = window._paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(["setCookieDomain", "*.gigadb.org"]);
  _paq.push(["setDoNotTrack", true]);
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="https://gigadb.matomo.cloud/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '1']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.async=true; g.src='https://cdn.matomo.cloud/gigadb.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Matomo Code -->
rija commented 8 months ago

Hi @luistoptal If you could have a look at this, when you've got a moment, that would be great.

only1chunts commented 8 months ago

This is quite high priority as (presumably?) without this done we will have zero analytics data on any traffic using our website. I don't mind that we can't visualise it immediately as long as we have the underlying data to be able to visualise it at some point in the future.

rija commented 8 months ago

@only1chunts yes, that's correct @luistoptal there may be a Google analytics JS bug already on pages which obviously need to be removed in the process.