Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cookie_consent_update event #86

Open
BKKNomad opened this issue Jul 23, 2024 · 2 comments
Open

cookie_consent_update event #86

BKKNomad opened this issue Jul 23, 2024 · 2 comments
Labels
question Further information is requested

Comments

@BKKNomad
Copy link

Hello Guys,

I'm figuring out an issue with your cookie consent solution, which is great in the meantime.

There are many dataLayer events like this when the cookie consent is updated (one event per type of cookie):

  • consent_analytics_storage
  • consent_ad_personalization
  • consent_ad_user_data
  • ...

However, there is no final cookie_consent_update event that would allow us to trigger tags anytime the cookie consent is updated (a uniform event that triggers regardless of the type of cookie).

Currently, I cannot trigger tags based on the existing detailed events as these tags will trigger too many times. Would it be possible to send a final event anytime the cookie consent is updated?

Many thanks for your help and best regards

@BKKNomad
Copy link
Author

BKKNomad commented Aug 5, 2024

Hello,

Do you have any answers to my previous request? Would it be possible to send a dataLayer event cookie_consent_update every time consent is updated?

Many thanks in advance for your help and best regards

@tg666
Copy link
Contributor

tg666 commented Aug 30, 2024

Hi,
It should be possible to achieve this behavior by attaching custom event handlers to the consent:first-action and consent:changed events.

<script>
    function onConsentUpdated() {
        window.dataLayer.push({
           'event': 'some_consent_changed',
        });
    }

    window.cookieConsentWrapperEvents = window.cookieConsentWrapperEvents || [];

    window.cookieConsentWrapperEvents.push(['consent:first-action', onConsentUpdated]);
    window.cookieConsentWrapperEvents.push(['consent:changed', onConsentUpdated]);
</script>

@tg666 tg666 added the question Further information is requested label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants