Setup GTM "Consent Changed" Event

The "Consent Changed" event allows scripts managed by Google Tag Manager to immediately react to changes in the users consent when the make a selection in the Consent Manager Widget.

Prerequisites

Before setting up the "Consent Changed" event be sure to complete the following:

  1. In Polaris check the Publish Notices page and confirm that item #2 "Add Polaris Client-Side JavaScript to your website" is setup correctly.
  2. Complete the guide, "Setting Up Cookie Consent in Google Tag Manager"

Setup

Step 1: Create the "Consent Changed" Event


  1. Open up Google Tag Manager and open up the websites workspace you are configuring
  2. In the left navigation bar, select Triggers
  3. In the Triggers window, click New
  4. A window will pop up from the right side, name the trigger "Consent Changed" by clicking on the text "Untitled Trigger" and modifying it.
  5. Hover over Trigger Configuration and click the edit button which appears in the upper right corner.
  6. A pop up opens from the right, scroll down to "Other" and select Custom Event
  7. Under "Event Name" enter consentChoice
  8. Leave the setting "This trigger fires on" set to All Custom Events
  9. In the upper right click Save

Step 2: Enable Consent Overview

Google Tag Manager has introduced a feature called Consent Overview that allows users to quickly check the consent settings of all their tags at once, as well as make bulk edits to consent settings so that you don’t have to click into each tag individually. For sites with dozens of tags operating, using this feature can save a lot of time.


How to Enable Consent Overview
  1. Select the Admin tab from the top navigation
  2. Click Container Settings
  3. Select Enable Consent Overview
  4. Save your settings

With Consent Overview enabled, you can return to Workspace→Tags. Along the top of the Tags menu, you should now see a shield icon. Click this shield icon to access Consent Overview.


Step 3: Link the "Consent Changed" Event to your Tags

  1. In the left navigation bar, select Tags
  2. Open up "Consent Overview" by clicking on the Shield Icon
  3. Under the "Consent Configured" check the box next to the appropriate tags by clicking the Checkmark to the left of "Tag Name."
    1. See the following section, What Tags Require the Consent Changed Trigger?, to determine which tags should be given the Consent Changed event
  4. Click the Three Dots "..." in the upper right of the "Consent Configured" window
  5. Select Edit Triggers
  6. To the right of "Firing Triggers" click the Plus (+) icon
  7. A "Choose Trigger" pop up opens from the right, select the "Consent Changed" trigger by Clicking on it.
  8. In the upper right click Save
  9. You will be prompted "Are you sure you want to apply these changes to # selected tags?", confirm by clicking Save
  10. Close the "Consent Overview" window by clicking the X icon in the upper left
  11. You are now ready to go live on your site, you'll need to publish the container. To do so, click Submit in the top-right corner, then Publish

What Tags Require the Consent Changed Trigger?

The Consent Changed trigger is intended to enable you to selectively introduce or exclude page-level content as soon as a user changes their consent preferences. It is not intended to be added to tags that react to in-page events, like measurement of a scroll position or performance of a checkout step.

For tags that measure consumer actions, you should only use the built-in Google Tag Manager "Additional Consent Checks" feature to control whether the tag is allowed to run (based on a consumer having provided the corresponding consent).

Examples

Add Consent Changed Do not add Consent Changed

Pixels and generic page-level scripts:

  • Meta / Shopify / Klaviyo pixel
  • HotJar or other measurement scripts
  • Customer support / chatbot scripts

A tag that runs in response to a consumer action:

  • Event tags that send info to a measurement script (e.g., checkout complete, scroll position changed)
  • On-page interactions

In either case, you'll need to specify the consent categories required for a tag. Use Google Tag Manager's built-in "Additional Consent Checks" to do this. Some tags, like Google Analytics, will already have standard categories set up that you won't need to modify - they will appear as "Built-In Consent Checks":

Other 3rd party tags will require you to categorize them and determine the appropriate consent category to add as an "additional consent for tag to fire." This is an important step to ensure tags are running only for consumers that have consented to a particular consent category.

For more detail on the "Additional Consent Checks" pattern, reference our article on Setting Up Cookie Consent in Google Tag Manager and review the sections regarding "Consent Category".

Step 4: Test Your GTM Integration