ppoffice / hexo-theme-icarus

A simple, delicate, and modern theme for the static site generator Hexo.
https://ppoffice.github.io/hexo-theme-icarus/
MIT License
6.28k stars 1.54k forks source link

Include Matomo Analytics as a built-in plugin option #1052

Open punksinatra opened 2 years ago

punksinatra commented 2 years ago

Make sure you go through the Hexo docs, Icarus user manual, and GitHub issues to see if the feature you are requesting has been already addressed by others.

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like Possibility to include matomo analytics as a built-in feature

A clear and concise description of what you want to happen. having the javascript calls for matomo included within the theme just like for google analytics.

A clear and concise description of any alternative solutions or features you've considered. This theme changjinglu has it implemented.

Add any other context or screenshots about the feature request here. more info for matomo here

Sample javascript that needs to be included to each page for the tracking to work

<!-- 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="//domain.tld/";
    _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=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Matomo Code -->