Thanks for previewing Google's new tag documentation! This site is in public beta. (Feedback)

Tag Assistant Consent Mode debugging

This article is for website developers and administrators using Google’s Consent Mode – either directly or through a consent management solution – who want to make sure that it is working correctly. Tag Assistant provides visibility into whether and how consent state is being set and updated using any of the following:

Tag Assistant is a web application with an optional recommended browser extension, Tag Assistant Companion. Tag Assistant enables you to check:

  • If the correct default consent state is being set for the applicable consent types, such as ad_storage and analytics_storage, before any tags fire. The appropriate default depends on your organization's policies.
  • Whether consent state is updated correctly when visitors grant or deny consent.
  • The consent types that each tag checks.
  • Whether the required consent types were granted when each tag triggered, and whether the tag passed the checks for any additional required consent.

To debug consent configuration, launch Tag Assistant, use it to open a page on your site, and imitate visitor behavior. Exercise all possible visitor use cases, each in a separate test. For example, deny all consent, grant all consent, and try all potential combinations. You might also need to take other actions on the page that trigger all tags with consent checks. After each test, switch to the Tag Assistant window.

The left pane of the Tag Assistant shows page events, the most recent on top. To navigate:

  • Select an event to view the consent state and configuration at that time.
  • Select the Consent tab to see consent state for storage types.
  • Select the Tags tab (GTM container only) to see when tags have fired and when they were blocked by the consent state.

The following example shows the Tag Assistant window after testing a page. With the Consent event selected, the Consent tab shows Event Consent State for ad_storage and analytics_storage at this point in time. The Event Consent Configuration Status table shows the presence of default and update consent commands at the time of each event. This can be used to verify that the consent state updates correctly when visitors grant or deny consent.

Event consent state

When Consent State is updated, the Default and Update status shows as Detected:

Consent state updated

TCF example

The following screen shows the message, TCF compatibililty enabled. It displays below the Event Consent Configuration Status table when the TCF is used to set Consent State:

TCF compatibility enabled

If Tag Assistant detects an implementation error, it also displays below the Event Consent Configuration Status table:

TCF error

Tag Assistant reports on the most common issues with ordering and timing for consent configuration:

The Tag Assistant Consent tab will be empty if Consent Mode is not implemented on the page.

The default consent state should be set on the page before any tags or other code try to use or to update consent. Setting the default too late may not have the anticipated effect.

For example, in the following scenario, the Ad tag has already read or written a cookie before the default consent is set:

  1. Visitor opens page
  2. Ad tag fires
  3. Default consent set to denied

Tag Assistant reports an error:

Tag Assistant error

To fix this problem when:

  • The default is set with a gtag consent command hard coded on the page: Move all code that calls gtag consent default commands higher in the page, above any tag snippets or other code that might be using consent. Avoid setting default consent states asynchronously.
  • Using Google Tag Manager: If default consent state was set by a template tag, ensure the consent-writing template tag fires on consent initialization trigger and all other tags dependent on consent states fire on triggers after consent initialization. If you are using a custom HTML tag in GTM to call the gtag consent commands, you should switch to using a template tag that uses the custom template API to set consent states instead.