In “Enable Tracking” options, seems like the bug happens using all the options except “Disabled” and “Enter manually”. Now, “Enter manually” -actually- inserts the tracking code just like the other options, but with this one, the bug doesn’t happen, what changes using this one instead of the other ones?
How to reproduce the issue:
* set wp-piwik to use “PHP API” and “Default Tracking” mode
* install “autoptimize” plugin (use any options on it)
* Bug: you will see many “content-security-policy” errors in the console, features not working on the website, and statistics not working at all
* switch to “enter manually” tracking code to compare that with this option there’s no bug
I don’t know how this autoptimize plugin works, but if I got it right, it touches the JavaScript code on a page. So I have no idea how it may affect the PHP mode… it is just used to communicate with Matomo, but does not change the tracking code.
Do you have some further information about the error messages you get? The examples you posted in the other thread are related to Youtube and not Matomo.
By the way, I’m not sure if it is a good idea to minify, cache or aggregate the tracking code. Is it possible to exclude it from autoptimize?
Yes it touches the JS for optimization.
The example on the other thread is a single example of errors, on this case was about Youtube, but it affected many other things (matomo, youtube, google fonts, google analytics, etc…). This issue only happens when I use “default tracking mode” on matomo but not when I use “enter manually”
Yes I have tried to exclude it from autoptimize but the bug stills present, which is quite strange
Hello,
I have the same problem, but without autoptimize or others plugins. This plugin seems to insert a Content Security Policy header somewhere and it breaks every external resource :
default-src
‘self’
‘unsafe-inline’
‘unsafe-eval’;
img-src
‘self’
‘unsafe-inline’
‘unsafe-eval’
data:;
In my case, it blocked my external fonts. I disabled all plugins, and I have the problem by reactivating WP-Matomo Integration (WP-Piwik) alone.
And you can’t change it by adding your own rules as CSP rules are always applied : if something blocks it will block whatever you can add after.
I don’t know where it comes from, but it is necessary to remove this set of CSP rules I think.
Thank you !
And also, another thing : the problem doesn’t occur when I am logged as admin…
Hello
I have the same problem as @vladimir-slonska
I deactivated Matomo from my two pro sites.
I kept it in test on a site while waiting that the problem is solved.
It’s a pity to have to put Google analytics back because the so called alternative to Analytics doesn’t work
I hope a solution will be found soon.
Sincerely
Philippe