[cXF] Matomo Analytics

[cXF] Matomo Analytics 1.1.0

No permission to download

BassMan

Well-known member
BassMan submitted a new resource:

[cXF] Matomo Analytics - Simple tracking code integration.

With this simple template modification you can easily add your Matomo (formerly Piwik) tracking code (if you don't want to edit your template directly).

Set all your Matomo analytics settings in Matomo control panel and simply paste the tracking code to a text box in options:
View attachment 171091



How to track visitors by username in Matomo?
In your tracking code find:
JavaScript:
var _paq = _paq || [];

... and paste next...

Read more about this resource...
 
Hi this looks great. Unfortunately it seems my tracking code is a little different and I'm not sure where to add the code, it doesnt seem to be working if I just add it anywhere.

JavaScript:
    <!-- 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="//example.com/";
    _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 -->
 
BassMan updated [cXF] Matomo Analytics with a new update entry:

1.1.0

  • XenForo 2.2 compatibility update

Note: you'll find two ZIP files when downloading. One for XF 2.1 and one for XF 2.2. Please, make sure to use the right version.

XenForo 2.2 is currently still in beta stage and it is not recommended to use it in production, but if you'd like to install the add-on on your test forum to check it out, now you can. This add-on may get another compatibility update before the XenForo 2.2 "gold" release.

Read the rest of this update entry...
 
Can you explain more about what is possible with Matomo in Xenforo?

For example, can I use Matomo to track where each specific user goes on my forum? Like, say they start on a specific thread then go to the forum list page then to a specific category then another thread then leave the site? Is this an example of what Matomo would show me? What else?

Thanks
 
Can you explain more about what is possible with Matomo in Xenforo?

For example, can I use Matomo to track where each specific user goes on my forum? Like, say they start on a specific thread then go to the forum list page then to a specific category then another thread then leave the site? Is this an example of what Matomo would show me? What else?

Thanks
Yes, if you add the code as described on the Overview page, then it should work like that.
 
BassMan updated [cXF] Matomo Analytics with a new update entry:

1.1.0

XenForo 2.2 is currently still in beta stage and it is not recommended to use it in production, but if you'd like to install the add-on on your test forum to check it out, now you can. This add-on may get another compatibility update before the XenForo 2.2 "gold" release.

Still working fine with xF 2.2 and php8? No compatibility update was required?

Asking some questions about Matomo itself at https://xenforo.com/community/threads/matomo-analytics.204454/
 
Yes, no problems. I'm running Matomo on my NAS device with PHP 8.0.16 without issues. And there's no update required for this add-on, because it is actually a simple template modification where you paste your Matomo tracking code.
 
My Matomo installation recently stopped tracking. I was able to resolve the problem by disabling the Better Analytics add-on. Once disabled, the Matomo javascript returned to source via this add-on. Just FYI. I will repost this on the Better Analytic add-on threads.
 
Thank you for this information. If your Matomo code changes for whatever reason, you just have to update the code in the template.
 
My Matomo installation recently stopped tracking. I was able to resolve the problem by disabling the Better Analytics add-on. Once disabled, the Matomo javascript returned to source via this add-on. Just FYI. I will repost this on the Better Analytic add-on threads.

This is to be expected, because the Better Analytics add-on changes the template with the Matomo code, so it is no longer sent to visitors.

You would need to put your Matomo code into the template the Better Analytics add-on provides to use both statistics.
 
OK, it works liek it should. :)

If I add the code:
HTML:
<xf:if is="{$xf.visitor.user_id}">
    _paq.push(['setUserId', '{$xf.visitor.username}']);
</xf:if>
in my generated tracking code from Matomo - do I see at Matomo the usernames of the visitors when they are logged in and on my sites?
And if so - where can I see them in my Matomo stats later?

Edit:
OK, I see it at Matomo now, it has take some time a little bit.
 
Last edited:
Top Bottom