Hey Piwik community
What is the recommended way of setting up Piwik with GTM with a third-party consent manager where you by default track users anonymously without cookies but when they confirm analytics tracking cookies are used.
My impression is that you should:
Turn “Use a session ID” and “Use visitor cookies” off in the Piwik administration settings.
Then, you load the Piwik snippet from GTM on every pageview and that will automatically respect these privacy settings.
And then when users opt into tracking you can use
To inform Piwik to write/read cookies.
But I’m wondering how this works on subsequent pageviews. Should we call _paq.push([‘deanonymizeUser’]); on every single subsequent pageview?
Or does Piwik “read" cookies even if it’s in “anonymised” mode and see that cookies are set and automatically move out of anonymous mode? In other words - is deanonymizeUser stateful?
And if it is NOT stateful should it be added:
- Before the pageview (In the init somewhere?)
- After the pageview on each page (Does this double the events sent to Piwik and incur additional costs?)
Cheers, loving your product and what you guys are doing.