CDLUC3 / ezid

CDLUC3 ezid
MIT License
11 stars 4 forks source link

Configure Matomo Tracking Code for EZID #435

Closed marisastrong closed 11 months ago

marisastrong commented 1 year ago

https://developer.matomo.org/guides/tracking-javascript-guide

mariagould commented 1 year ago

Hi @marisastrong can you provide more details about the Matomo transition so we can plan the work accordingly? Thanks.

marisastrong commented 1 year ago
<!-- 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.cdlib.org/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '21']);
    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 -->
datadavev commented 1 year ago

Does Mataomo support programmatic creation of events? e.g. Plausible^1 allows POST to an API endpoint to record an event which is very helpful for tracking API access where a browser JS client is not available.

This would be useful in EZID since a lot of traffic goes through the API rather than the UI.

marisastrong commented 11 months ago

@datadavev I missed the query earlier on tracking events. I was able to find this documentation in Matomo that seems to serve this purpose.

https://developer.matomo.org/api-reference/tracking-api

I'm not sure if other programs are utilizing this feature. I can check with them.