WordPress and Matomo(Piwik) without plugins

I think that sometimes less is better. I don’t like to have many plugins and tools for every small thing.

To apply very good and complex stats without google eyes and plugins use Matomo (formerly Piwik). Add your tracking code from Matomo into your wordpress on footer (Apperance > Editor > Skin-Footer.php) at the end of file between <body> markers.

<?php wp_footer(); ?>
<!-- Matomo -->
<script type="text/javascript">
  var _paq = _paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  (function() {
    var u="//krai.be/stats/";
    _paq.push(['setTrackerUrl', u+'piwik.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+'piwik.js'; s.parentNode.insertBefore(g,s);
<!-- End Matomo Code -->


Leave a Reply

Your email address will not be published. Required fields are marked *