Do Not Track: per-site configuration

Piwik v1.8 now respect the Do Not Track header, which is great. However it is enabled / disabled at a global level. When enabled, Piwik will respect Do Not Track across ALL sites.

It would be nice if we could control this per-site. By way of example, I use piwik to track my public website as for internal sites. It would be nice to respect Do Not Track on the public website but not on my internal sites. My “internal sites” are sites where people within my company have logged in.

Disable the plugin and use the tracker’s DNT support.

Was about to add a new Feature suggestion för “Do Not Track: per-site configuration” but found this one. As I understand this is still not possible in the latest Matomo version.

We host multiple websites in the same Matomo environment and would need to be able to control this setting for each site individually.

I found that some config settings can be applied for specific sites but that does not include the Do Not Track-setting.

You can use the following Matomo JavaScript API method:

setDoNotTrack( bool ) - Set to true to not track users who opt out of tracking using Mozilla’s (proposed) Do Not Track setting.

https://developer.matomo.org/api-reference/tracking-javascript#configuration-of-tracking-cookies

Thanks! Does the API method override the global setting?

No, you just add this in the Matomo JavaScript bootstrap code (_paq.push(...)), then this should prevent the script sending requests to your Matomo server…

1 Like