Allow placing arbitrary HTML snippet in page <head> template?

Hi,

I’d like to put some arbitrary HTML snippet into the in the application template (privacy-retaining analytics using Matomo).

How could this be achieved?

Thanks!

arbitrary HTML snippet into the in the application template

Can you provide an example? Which pages would this appear? Is it a JS block like what you might see with Google Analytics?

Sure.

I need to add the <script>...</script> tag just above the </head>.

  <script type="text/javascript">
    var _paq = window._paq = window._paq || [];
     
    _paq.push(['trackPageView']);
    _paq.push(['enableLinkTracking']);
    (function() {
      var u="https://matomo.example.com/";
      _paq.push(['setTrackerUrl', u+'matomo.php']);
      _paq.push(['setSiteId', '42']);
      var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
      g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
    })();
  </script>
  
</head>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.