All Collections
Tracking
Cookie banner: •GTM + Consent mode •Onepage Analytics
Cookie banner: •GTM + Consent mode •Onepage Analytics

Learn about Google Consent Mode

Alina avatar
Written by Alina
Updated over a week ago

🍪

What’s GTM Consent Mode?

It's a framework designed by Google to adapt the behavior of various services (e.g., Google Analytics, Google Ads, FB Pixel, etc) based on the consent status of website visitors. It allows website owners to respect user consent for tracking when configuring the GTM container and its tags.

For more information about GTM, please click here.

How to configure GTM Consent Mode?

Within GTM, you can configure your tags to only fire based on the consent status. For each tag (e.g., Google Analytics, Google Ads, Meta Pixel, Linkedin, etc), you'll need to:

  • Go to the tag configuration in GTM.

  • Scroll down to the "Advanced Settings".

  • Select "Consent Settings".

  • Check "Require Consent" and select the appropriate consent types (e.g., "ad_storage", "analytics_storage") based on what the tag needs.

  • Add a “Consent initializationˮ trigger to run the code after accepting the cookie banner. Or any other custom trigger that will run after some website interaction.

This ensures that tags will only fire when the corresponding consent has been granted by the user.

How to understand which consent type you should use?

Below you can find the general description of consent types which can help you choose the proper consent type.

ad_storage

Enables storage, such as cookies, related to advertising.

analytics_storage

Enables storage, such as cookies, related to analytics.

ad_user_data

Sets consent for sending user data to Google for online advertising purposes.

ad_personalization

Sets consent for personalized advertising and remarketing

functionality_storage

Enables storage that supports the functionality of the website or app such as language settings.

personalization_storage

Enables storage related to personalization such as video recommendations.

security_storage

Enables storage related to security such as authentication functionality, fraud prevention, and other user protection etc

For more information directly from Google please click here.

The table below shows the relationship between our cookie banner privacy categories and the consent types that Consent Mode provides.

Category

GTM consent types

marketing

ad_storage

ad_personalization

personalization_storage

ad_user_data

analytics (performance)

analytics_storage

personalization_storage

functional

functionality_storage

security_storage

For example, if you want to integrate Google Analytics into GTM, you will configure the tag with analytics_storage consent. Then, when you will visit your website you will need to accept “All” or only the “Analytics” category to execute the Google Analytics code. It will not execute if you decline all the cookies or the Analytics privacy category.

The same logic can be applied for Meta Pixel. You will use ad_storage and ad_personalization as consents for the Pixel tag in GTM and this code will only execute if you will accept “All” or “Marketing” privacy category in the cookie banner.

FAQ

Can I use Google Analytics and GTM codes separately?

This is not recommended. This can lead to privacy and conversion tracking issues. Please use integrations that we provide to you in the “Site settings→Integrationsˮ tab or put everything into GTM Container with enabled/configured consent settings and add it as Google Tag integration in the “Site settings→Integrationsˮ.

Why is my GTM container loaded before accepting the cookie banner?

GTM itself does not set any cookies and it is just a tool to run other 3rd party codes.

My code is producing cookies, but the Onepage cookie scanner can’t find it.

We cannot detect some complex codes/cookies, but you can always add a cookie manually via the Cookie editor.

How to test GTM and Consent mode

  1. Create an Onepage project.

  2. Create a Google Tag Manager instance for websites.

  3. After the creation process, obtain the Google Tag Manager code. It will appear as "GTM-123123". Input this into the Project Integrations under "Google Analytics" and save it. Also, activate the advanced or compact cookie banner feature in the project settings.

  4. Create a "Custom HTML" tag with a dummy script, for example:

    <script> 
    console.log("This will only work after consent")
    </script>
  5. Open the tag’s advanced settings and navigate to "consent settings". Choose "Require additional consent for tag to fire". Add "analytics_storage" as an example.

  6. Add the trigger: "Consent Initialization - All Pages".

  7. Publish the container.

  8. Publish your Onepage project and open it in an incognito browser.

  9. Open the developer console. You should not see the "This will work only after consent" string.

  10. Accept the cookie banner. In our case, the "Analytics" category should be accepted, or all of them.

  11. The "This will work only after consent" string should appear in the console. This indicates that the container’s tag is only executed after you have given consent to run analytical scripts.

  12. This test can be repeated with all consent types. Mapping for the "privacy category" ⇒ "consent types".

Cookie banner + Onepage Analytics

Onepage Analytics is now disabled by default when creating a new site. The “Analytics” tab should not be displayed in project navigation.

To activate the Onepage Analytics module please go to “Site settings->Integrations” and activate the “Onepage Analytics” toggle.

Then the navigation tab will appear.

If the cookie banner is activated - our analytics will work only after accepting the cookie-banner with “All” or “Analytics” privacy category.

We also added the new item “one_stats_metadata” under “Analytics” privacy category in the detailed overview of the cookie banner to indicate that the project uses analytics and collects some data.


💡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?