Insert JS script for us with analytics, e.g. matomo, google analytics

I would like to insert a JS tracking code on every page of owncloud in order to send analytics to the Matomo app. The tracking code is included below. I do not want to touch any core OC files, for many obvious reasons. Is there any way to do this in OwnCloud?

<!-- Matomo -->
<script type="text/javascript">
  var _paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
var u="https://my.site.url/matomo/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Matomo Code -->

Found related issue:

1 Like

Hey,

for Piwik i had used the following app in the past but i’m not sure if this is still compatible / working with ownCloud:

1 Like

That app is no longer compatible. The developer says that it is now a nextcloud app and OC not supported. I have forked the app and I’m trying to make it work for owncloud again; it’s a work in progress.

What would be most useful, and perhaps not as hard is to have an OC app that adds an extras.js and extras.css script that can both be editing through an admin panel textfile. Then we can insert code snippets easily.

2 Likes