WP-Matomo
WP-Matomo copied to clipboard
Non-Js tracking image on modern Safari: no HTTP_REFERER
Hey all
I have recently been attempting to implement non-JS tracking with WP-Piwik and have found that modern Safari [desktop] browsers by default have a security policy which prevents inclusion of the site path in HTTP_REFERRER headers sent to Matomo's image tracker (because our Matomo host is on a different domain).
The standard workaround for this (to add HTML META tags or referrerpolicy attribute to the image) don't work and are ignored by Safari, so the fallback would be to include the page URL in the IMG query via ?url=X.
In the current user interface (I'm using 1.0.24) there's no mechanism to include any parameters into the image query and my attempts to "hack" this in through some PHP code in that field are (as they should be) escaped to prevent code injection.
Ideally, it'd be nice to have some sort of variable substitution for this field, or to have a check box which adds an option "Include URL parameter in noscript code".
I'd be happy to build this, if you'd be willing to look at a PR.
Would this be useful for others?
Cheers!