Relative Content

Tag Archive for javascriptgoogle-tag-manager

Why google consent initialization takes too long to trigger?

I am trying to implement the consent mode that Google requires on a website and 2 scripts that read consent values, read them before the actual values are set. As a result in Google tag manager I get the error “A tag read consent state before a default was set”. From the various testing procedures I have done, I concluded that even ‘Consent Initialization’ event that Google states is the first event that happens on the site, takes too much time to complete. Asychronous scripts that send data to analytics such as ‘www.googleadservices.com/pagead/conversion.js’ and ‘https://www.googletagmanager.com/gtag/js?’ finish execution before even ‘Consent Initialization’. I tried to check if window.google_tag_data is defined but ‘conversion.js’ cannot be triggered after the page done loading. I also tried defer and async attributes.
I cannot think of anything else of how to get rid of the ‘A tag read consent state before a default was set’ error. Anyone has any insight on this matter?

Why google consent initialization takes too long to trigger?

I am trying to implement the consent mode that Google requires on a website and 2 scripts that read consent values, read them before the actual values are set. As a result in Google tag manager I get the error “A tag read consent state before a default was set”. From the various testing procedures I have done, I concluded that even ‘Consent Initialization’ event that Google states is the first event that happens on the site, takes too much time to complete. Asychronous scripts that send data to analytics such as ‘www.googleadservices.com/pagead/conversion.js’ and ‘https://www.googletagmanager.com/gtag/js?’ finish execution before even ‘Consent Initialization’. I tried to check if window.google_tag_data is defined but ‘conversion.js’ cannot be triggered after the page done loading. I also tried defer and async attributes.
I cannot think of anything else of how to get rid of the ‘A tag read consent state before a default was set’ error. Anyone has any insight on this matter?