Skip to main content

Cookie banner + Google Tag Manager

Basic usage of cookie banner with Google Analytics

Written by Alina


Cookie banner + GTM

Basic usage with Google Analytics

  1. Create a tag, e.g. GA4.
    ​

  2. Open the tag.

  3. Then add a trigger “Consent Initialization”.
    ​

  4. Save and publish your tag.

Going forward, when your customers visit your site, they will not be tracked until they accept a cookie banner consent.
​


Usage with other external tools

  1. Create a tag, add your third-party code to it.

  2. Open the tag.

  3. Add a “Custom event” trigger.
    ​

  4. You can use these custom event names depending on third-party code category and use-case:

    1. onepage_received_consent

    2. onepage_received_consent_unclassified

    3. onepage_received_consent_marketing

    4. onepage_received_consent_analytics

    5. onepage_received_consent_functional

    So, when the user chooses some tool categories in the cookie banner, corresponding events will be triggered and GTM will load only those scripts that are depending on a custom trigger.
    ​

  5. Save and publish your tag.

  6. Go to your project settings in Onepage and add some cookies that your script will produce, so your customers will see what third-party tools you are using and their use cases.

Going forward, when your customers will visit your site, they will be able to disable the loading of third-party scripts, and they will not receive any cookies.

You should add a separate tag and different custom triggers depending on the tool category for each third-party code.



💡Do you have any feedback concerning this article? Please let us know through our live chat or at support@onepage.io, so we may keep it up to date. Thank you! 🙂

Did this answer your question?