Aerendir
Aerendir

Reputation: 6399

Google Tag Manager, Cookiebot and Google Analytics: which are the consequences of switching from "Page View" to "Window Loaded" track type in tags?

I'm following the guide from Cookiebot to implement the cookie banner with Google Tag Manager that explicitly states that:

Please note: If your existing trigger is of the event type "Page View", you need to change it to event type "Window Loaded" since the visitor's consent is not available to GTM before the window has loaded.

Practically, to be fully compliant, before firing the Google Analytics tag we need to check for the visitor's consent about cookies and to get the visitor's choices from Cookiebot, we need to wait for the "Window Loaded" event: before this event, Cookiebot cannot get the correct value for the choice (and I don't know why).

But all the Google's guides about how to configure Google Analytics through Google Tag Manager use the track type "Page view", that is earlier than the "Window Loaded" event.

So, my question is:

What are the drawbacks, if any, of switching Google Analytics' tag from "Page view" track type (as suggested anywhere by Google) to "Window Loaded" track type (as suggested by Cookiebot)?

Upvotes: 1

Views: 1367

Answers (1)

Дмитро Булах
Дмитро Булах

Reputation: 3847

all the recommendations on firing GA tags at "pageview" event do not account for GDPR compliance. PageView event is fired at the moment when the browser is only starting processing the page content before any interaction took place. Therefore no no visitor's choice on cookie was made.

The easiest way to fire GA tag with Cookiebot consent is to fire GA tag with cookieconsent_statistics custom event that indicates proper visitor approval (p.2 at cookiebot guide)

Upvotes: 0

Related Questions