Jump to content

Matomo (Piwik) connecting to PW


Troost
 Share

Recommended Posts

Hi Guys,

I've just installed Matomo on my portfolio website to track some visits and the behavior. But it doesn't work.
I have it installed this way...

hostname.com
hostname.com/matomo (this works with the dashboard etc)

hostname.com which echos PW, but the thing is, the PW site structure works with site/templates/home.php

This is the Matomo code which I placed in the header.php

<!-- 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="//hostname.com/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 -->

So I guess its in the

    var u="//hostname.com/matomo/";

I'd tried to place the map in the templates folder and link it by <?php echo $config->urls->templates?>matomo/
But that didn't work either. 

I'd also tried to put in the full url of the map in the var u, but it all didn't work out.

Does someone have a solution to connect Matomo to PW?

 

Thanks in advance

Link to comment
Share on other sites

General thoughts on this...

I never installed Matomo into a subfolder on a ProcessWire website. Therefore I can't tell if this works out of the box or if ProcessWire tries to protect that folder in some way. I'd suggest installing matomo somewhere else - a subdomain for example.

https://matomo.domain.tld/ - would probably be the easiest way here.

After that tracking should work - unless you misconfigured Matomo or block tracking with DNT or the Ghostery extension.

 

But... there is one thing I don't understand. You are saying "place the map in the template folders" - what map?

  • Like 2
Link to comment
Share on other sites

Moderator note: this is not a module support thread, so I'm moving it to the General Support area of the forum instead. Please keep in mind that the Modules/Plugins area is only intended for module-specific support threads. Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...