68publishers / cookie-consent

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

default consent on page rendering after cookie banner accepted #78

Open sachatrauwaen opened 6 months ago

sachatrauwaen commented 6 months ago

Hi, After a work session with a Ads specialist and reading the google tag manager documention, there is a issue with the setDefaultConsentState in the template.

The setDefaultConsentState need to be called with values respecting regional laws. So for EU most of permissions need to be denied.

And the user accepted permissions need to be set with updateConsentState.

And in gtm_template.tpl the setDefaultConsentState is called with the values comming from the cookies with are not the defaults respecting the region law.

This happen on the page rendering after the cookie banner is accepted and the banner is not shown enymore.

If you agree with this, i can make a pull request for it.

Regards, Sacha

tg666 commented 5 months ago

Hi, sorry for the late response. If I understand correctly, it would be ok if the following would be called in the GTM template:

setDefaultConsentState({ ... real defaults ... });
updateConsentState({ ... permissions from the cookie value ... });

Thus setDefaultConsentState and immediately afterwards updateConsentState.

Is that right or am I wrong?

robwoodgate commented 4 months ago

I think that's right.

If I may contribute to this discussion, I believe what's ideally needed is a region aware Default Consent Setting, which would look similar to the Composite Consent setting. This would allow ISO-3166-1 alpha-2 country code region defaults to be set as per Google Docs.

Here's a mockup of the fields to give the idea... though false/true might be replaced with denied/granted...

Screenshot 2024-06-06 at 14 56 22

This would allow the default state (in Visibility and Default State) to be "tweaked" regionally as required. For example, only setting default of denied in regions (like EU) where this is required... but allowing implied consent by default in more relaxed regions.