68publishers / cookie-consent

:cookie: Cookie-consent widget with GTM, GCM & CMP integration
MIT License
118 stars 28 forks source link

Not sending pageview request on consent? #62

Closed will-yellowpeach closed 1 year ago

will-yellowpeach commented 1 year ago

We're using your GTM implementation which is great first of all.

When a visitor first lands on the site GA is blocked, but at the point of giving consent it doesn't seem to send a pageview request to GA for that initial view - meaning we always miss out on tracking that initial pageview. Is that as expected?

If that is as expected, is there any way to trigger that pageview request after consent?

jelen07 commented 1 year ago

Hi @will-yellowpeach,

This depends on the implementation on the GTM side. Do you notice the described behavior e.g. on https://www.datart.cz?

will-yellowpeach commented 1 year ago

@jelen07 that example looks to be how we want it - it fires the pageview requests on cookie consent. What changes do we need to implement in GTM?

Currently we're just triggering the GA tag on the default 'All Pages' but presumably that needs a different trigger?

jelen07 commented 1 year ago

For time reasons I can't send you more detailed information, but the main idea of implementing these UCs is that if you don't have consent, you collect the data or any analytics on the client, but you don't send it. Once you have consent, you send all the data collected so far.

This could be handled similarly to the initial visit. You save it in your dataLayer and only send it when you have consent.

Some tools try to help with this, and their clients or tracking functions initialize in "I have"/"I don't have" consent mode. You can additionally call over them that the user has granted or denied consent and they will behave accordingly (collect data vs collect and send).

A similar approach is described for example in the SpeedCurve tool https://support.speedcurve.com/docs/cookie-consent-banners

There are many articles on the web that address this issue, e.g. https://www.cardinalpath.com/blog/consent-mode-delivering-analytics-while-respecting-consent

It's not so much a 68publishers/cookie-consent issue as it is an implementation of these tools along with consent mode.

I believe this will help.

jelen07 commented 1 year ago

Example

Snímek obrazovky 2023-10-24 v 19 39 31
will-yellowpeach commented 1 year ago

@jelen07 makes sense, thanks for the pointers