I use the Matomo Analytics tag in the Matomo Tag Manager. I have checked
Require cookie consent in the configuration variable. I am storing consent information in a 3rd party tool. Therefore I am using three tags to realize tracking with/without cookie consent, depending on the users’ choice:
- Matomo Analytics - Initialize (Prio 0)
- Custom HTML - call
_paq.push(['setCookieConsentGiven']);or not (Prio 100)
- Matomo Analytics - Pageview (Prio 999)
Those three tags are all fired on the same trigger, a simple pageview without any filter.
My understanding is that Initialize will completely set up the tracker, as if I was using the JS tracker and calling
_paq.push(['requireCookieConsent']); during setup. Then my custom tag either grants consent or not, while the third tag executes the pageview tracking with the applicable consent setting.
I can see that the cookie
_pk_id is being written when consent was given. The problem I see is that the value in the cookie changes with every pageview. Therefore if I open the site, have the cookie set and come back after 30 minutes have passed, those two visite are not being tied together as they should be.
My assumption about intended behavior is that when you give cookie consent the first time, the cookie will be written with a unique id. The calls to
setCookieConsentGiven on subsequent pageviews should only decide whether the id from the cookie is sent along in tracking requests or not. They should not rewrite the id itself with a new value each time.
Is what I am seeing intended, that the id in the cookie changes with every pageview? Or am I doing something wrong?