Skip to main content

Google Tag Manager

DataGrail Consent features a foundational integration to Google Tag Manager (GTM), making it easy for most businesses to have turnkey compliance with CPRA, GDPR, and other privacy policy frameworks. With DataGrail Consent, we integrate with GTM using our no-code solution, controlling how scripts are loaded onto your page and serving the banner notice functionality directly to any site connected to that container.

This document is written for developers, expanding more on our integration with GTM, explaining how we work with Consent Mode, and walking through how we create workspace versions within your GTM containers. Customers getting started with Consent and GTM can follow the step by step instructions here to deploy DataGrail Consent to their websites and apps using GTM.

DataGrail manages your containers configuration for Consent using Google's Consent Mode, as well as supplying the specific consent banner configuration code as its own tag within your container.

Upon connecting your container(s) to DataGrail Consent, DataGrail will retrieve tags created within the latest "live" (aka published) version of the container, which will allow you to categorize the tag within DataGrail and send this information as a consent check to Google.

DataGrail will also create a tag (specifically created as "Consent Banner Tag Template") within your container that includes the javascript code that powers DataGrail Consent, including the configurations necessary to set the appropriate Consent behavior based on the user's location and where that maps to the policies defined in the settings page.

Lastly, DataGrail will create additional variables in your GTM container for various pieces of functionality required for consent compliance.

Setup and Publishing

When you first log into DataGrail to configure DataGrail Consent, you are presented with the option to connect Google Tag Manager with your Google account so we can retrieve the container configurations necessary to deploy DataGrail Consent to your website. When you select containers for management within DataGrail, you are allowing us to push changes directly to the GTM containers associated with your website(s). This makes it easy to have a seamless, no-code deployment of DataGrail Consent and any future updates you'll make as you add new tags to your container, reclassify cookies, or make any tweaks to your banner layouts as part of normal maintenance of your consent deployment.

After you have connected Google Tag Manager, you will need to configure your banner layout to your company's specifications. You can use our built in layouts editor within your DataGrail Consent environment to construct a banner to your exact needs, using CSS customization to further customize the banner UI on your website to match your company's design system. As a customer of Google Tag Manager, Google advises clients to have a banner that explains that data is collected for advertising purposes, links to Google's privacy statement, and offers an affirmitve consent option. DataGrail Consent has preconfigured your layout to support these requirements by default.

When you have finished configuring your banner's layout, tag and cookie classifications, and policy settings, you can use our no-code publishing process to send updates directly to GTM. After you select the action to review and update GTM, DataGrail Consent creates a new version of your GTM container(s) that include(s):

  1. The updates to Consent Settings for each tag as categorized within DataGrail
  2. The Consent Banner Tag Template that contains the javascript code that serves the banner notice and handles a data subject's consent choices.
  3. Additional variables required for DataGrail Consent functionality to support Universal Opt-Out Mechanisms (UooMs; the Global Privacy Control (GPC) and Do Not Track (DNT) signals).
Gallery Template

If you choose to use our Google Tag Manager template published to the Community Gallery, you use our embedded deployment capability to retrieve the UUIDs necessary for the tag created from the template. The publish process generates a custom configured tag template that is unique to your DataGrail Consent configuration built within your DataGrail environment. Therefore, we do not recommend the use of this template.

In your DataGrail environment, you can choose if we create and publish version updates, or simply create version updates, using the publish drawer below:

The publish action creates a container version within your Google Tag Manager workspace. If the version is tagged as "live", the consent banner will be visible to all users on websites connected to this container. If it is only tagged as "latest", the container version needs to be manually published via Google Tag Manager.

info

Note that "published by" is determined by the user that created the integration within DataGrail.

Creation without publishing is useful for customers who want to make additional changes to the container version in addition to the DataGrail changes before publishing it, either manually or as part of an external managed deployment process.

After creating the container version, you may also want to use the Tag Assistant tool (aka "preview mode") to test DataGrail consent on your website:

Example Walkthrough With Tag Assistant

The Tag Assistant tool allows you to simulate the updated container version running on your site in a sandbox environment, before publishing to your production website. Click here for more information on the tag assistant.

Here's an example of the tag assistant output for our simple DataGrail Consent Demo site

  1. First, you will see the banner tag template intialize as the first event on the page.

  1. Next, you will see a set event with DataGrail's developer ID appended.

  1. You will then likely see multiple consent default commands events. One of the events is the default settings defined within your DataGrail environment, which has no regions defined.

  1. The other default command event contains several enumerated regions, based on the policies you have defined within DataGrail. The countries within this list are those that are defined as "opt-in", or the user is not tracked until consent is provided.

  1. Google will determine the user's geolocation and apply the appropriate default based on regional specificity. In this example, the user is in a US state, which is not enumerated in the list above. Appropriately,the consent state was set to granted for all events.

  1. Let's say a user opts-out of all trackers on the demo site. You'll see two sections in the side navigation. The section towards the top is the current page session, whereas the section below that one is the previous page session. Two page sessions are created because DataGrail refreshes the browser when it sees a difference in consent state requested by the data subject.

    This ensures maximal protection of privacy and that consent choices are honored at the moment of the request. One of the last events sent in the previous page session is a consent update command corresponding to the choices made with the banner. In this instance, the user rejects all categories.

  1. In the new page session, the default command reflects the data subject's previous consent options. You'll notice no regional commands are sent on subsequent sessions, as we only go off of what is provided by the data subject on a go forward basis.

This example should be taken as a reference point for troubleshooting your consent setup. Keep in mind that events may not load in this order due to browser limitations, but DataGrail Consent loads asynchronously and will act on whatever preferences are emitted appropriately.

Google Consent Mode is a feature of Google Tag Manager that alters the behavior of tags/services based on the signal provided to them by DataGrail Consent. By default, we enable Advanced Consent Mode support within DataGrail. With Advanced Consent Mode, DataGrail uses built-in GTM commands to alter the behavior of all tags hosted within your container. The following list of tags are consent-aware, meaning they will trigger based on whether or not built-in Consent checks are enabled:

  • Display & Video 360
  • Search Ads 360
  • Google Campaign Manager 360
  • Google Ads
  • Google Ads Remarketing
  • Google Ads Conversion Tracking
  • Google Analytics 4
  • Google Analytics
  • Conversion Linker
  • Doubleclick Ad (Note: this product is deprecated)
  • DoubleClick Floodlight (Note: this product is deprecated)
  • Google Campaign Manager (Note: this product is deprecated)

If there are additional tags whose behavior should operate under advanced consent mode, you can select the tag within the tracking services table and toggle that setting on for that tag.

With Advanced Consent Mode support, DataGrail Consent will map the categories within your environment to these built-in consent types such that you can utilize the Advanced Consent Mode features should a data subject reject tracking for categories that map to them. You can use the settings screen below to customize these preferences.

If you disable advanced consent mode, we will revert to Basic Consent Mode, which means all tags will set to blocked for users located within opt-in policy regions.

Troubleshooting

info

If you are a client of Google's or Google itself and looking for support, please reference this in the subject line of your help request.

Sometimes there can be issues with permissions or container configurations that interfere with DataGrail's ability to create managed container versions within your Google Tag Manager account. Here are some steps to troubleshoot the most common issues we've seen with customers:

Missing Containers

After setting up your Google Tag Manager integration by logging in to your account, we retrieve all of the tags for all of the containers for which you have read access. You'll see the full list of containers that we retrieved tags from by clicking the manage containers button within the settings page:

Containers enabled via the list are those that are eligible for version creation and consent management by DataGrail. If a container is not within the list, you do not have read access to this container.

Failed Version Creation or Publishing

After selecting to create or create & publish a container version to the containers selected, you will see the status of the process within DataGrail Consent:

DataGrail Consent creates updates for each container individually, which means you may only have an error at the end of the process on one of the containers. We usually provide the resulting error which can be for the following reasons:

  1. The account does not have publish rights for the container. While DataGrail Consent only requires read access to retrieve the tag information from GTM, you must have publish access for DataGrail to create our version updates within the respective containers. You can verify your permissions by container within GTM.
  2. The account has reached the limit of workspaces. Workspaces are staging areas to create versions within the container. DataGrail creates a temporary workspace to stage the updates before writing these as a new version. Free/Starter GTM accounts can have up to three workspaces, so be sure to delete extra workspaces that are not required before executing the creation process within DataGrail.
  3. API rate limiting. Rarely, DataGrail may not be able to complete the version creation process due to hitting a rate limit with Google. You can try the process again in a few minutes.

Region-Specific Settings in Server-Based GTM Implementations

If tags within GTM are not reflecting the correct consent type behavior as a result of the preferences sent by the data subject, it may be that the region-specific settings capability is not enabled in your server-side container implementation. You can enable the region specific settings feature in your Server-Side GTM setup using the "clients" tab, selecting the option to enable region-specific settings. By default, the variable {{Visitor Region}} will be populated, which is what DataGrail Consent needs to apply the correct behavior by region.

Browser Warning For Tag Events

If you configure DataGrail using our built in publishing flows, we will control the firing order of events within your GTM container as a result. If you are migrating from an alternative tool or attempted a custom implementation of GTM and Consent Mode, you may see a warning in your browser console if you have tag events firing prior to the default command set by DataGrail Consent:

Consent Mode default command executed after other tags

If you see this warning, please double check your GTM configuration to ensure no additional firing triggers or events are impeding DataGrail's CMP and GTM integration from operating successfully.

 

Need help?
If you have any questions, please reach out to your dedicated CSM or contact us at support@datagrail.io.

Disclaimer: The information contained in this message does not constitute as legal advice. We would advise seeking professional counsel before acting on or interpreting any material.