I don’t use them in my installation.
A few random thoughts:
- Best to test from a private/incognito session where you’re not signed in.
- Make sure your browser is not set to “do not track”.
- Check the network tab of your browser’s developer tools console and make sure the request is making it to your Matomo stats site.
- If you see errors in the console it’s probably because you need to set up CSP and add your Matomo site; there is a Discourse site setting for this.
For the many open source communities using Discourse that might see this and want to avoid things like Google, know that Matomo is offering free hosted installations for such projects if you don’t have the infrastructure or skills to install and run it yourself:
I have a problem with a ‘secondsite’ setup (through multisite.yml) On the original/main site this works fine, on the second site it does not. Javascripts are loaded through a pull CDN for both sites. Could that be a problem?
Matomo has always worked well for me, so this topic made me check how I have it configured to load…
Turns out I actually have it being loaded via a cloudflare “app”
A few features are missing in this theme component. Such as do-not-track and cookie settings. To be GDPR compliant without cookie consent it’s needed to make sure tracking cookies are disabled and people have the means to opt-out tracking.
For that the following parts need to be included:
_paq.push(['setDoNotTrack', true]);
_paq.push(['disableCookies']);
Or is this plugin working in a different way? Just assuming since I don’t see it here and also not when I search for donottrack
in that repo.
The Matomo web interface also lets you add these 2 paq lines easily. Maybe add these options to the Discourse plugin for easy configuration?
Will test this commit, if it works well I’ll submit a PR.
So far it has been working like a charm! But no word yet from the devs about a merge or other feedback.
Sorry about the very long delay here, I just reviewed the PR and left a comment.
PR looks good, but I would prefer the settings to be default off so that existing users of the theme component don’t get any undesired changes automatically.
The PR above has now been merged (thanks @AquaL1te), you can now enable do_not_track
and disableCookies
in the component settings.
Awesome! This small addition gives admins more control over what data is collected and also helps EU admins to comply with the GDPR better Thanks for checking and merging.
This theme-component doesn’t seem to work for me, unfortunately. Could use some help with it.
I installed the component and then added the necessary info (URL & ID) of my Matomo installation.
But Matomo is yet to register a single visit from the Forum.
In the browser dev console, i can see 2 types of requests to the Matomo instllation:
- GET https://matomo-url/piwik.js (Result 200)
- POST https://matomo-url/piwik.php? (Result 204)
Also, i have added my matomo-url to the content-security-policy settings.
I can’t help you, sorry, because all I can say is Matomo works for me just fine. I’m meaning the issue lays somewhere else then.
Are you totally sure Matomo can archieve results — cron is working or your settings allow it when visiting on Matomo?
Maybe you can see some hints in your browser’s error console?
@AquaL1te Nope, there are no errors in the console
There is never. Matomo just doesn’t work that way. Or Discourse.
99 times out of hundred it happends because of cron. Matomo gets data but can’t process it to metrics, because there is nothing, like cron, that triggers it. And Matomo doesn’t tell you that.
Are you hosting Matomo by yourself?
I’m self-hosting Matomo, via Cloudron.
Then there is the hundredth option: something is blocking datastream to your Matomo.
These are the (masked) logs from Cloudron/Matomo:
Nov 30 14:08:02 49.43.155.192 - - [30/Nov/2022:08:38:02 +0000] "GET /piwik.js HTTP/1.1" 200 21541 "****" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
Nov 30 14:08:03 49.43.155.192 - - [30/Nov/2022:08:38:03 +0000] "POST /piwik.php?action_name=**** HTTP/1.1" 204 - "****" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
Nov 30 14:08:03 172.18.0.1 - - [30/Nov/2022:08:38:03 +0000] "POST /piwik.php?action_name=**** HTTP/1.1" 204 231 "****" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
Nov 30 14:08:08 49.43.155.192 - - [30/Nov/2022:08:38:08 +0000] "POST /piwik.php?action_name=**** HTTP/1.1" 204 - "****" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
Nov 30 14:08:08 172.18.0.1 - - [30/Nov/2022:08:38:08 +0000] "POST /piwik.php?action_name=**** HTTP/1.1" 204 231 "****" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
Apparently, the requests are being received by Matomo just fine.
In Cloudron/Matomo:
Nov 30 14:15:13 172.18.0.1 - - [30/Nov/2022:08:45:13 +0000] "POST /piwik.php?action_name=***
Nov 30 14:15:13 49.43.155.192 - - [30/Nov/2022:08:45:13 +0000] "POST /piwik.php?action_name=***