How to configure Google Tag Manager to fire the Blue Tracely tag only after consent is given

Hold the Blue Tracely tag back in Google Tag Manager until the visitor consents, with a consent check and the right triggers, then test it.

If you install Blue Tracely with Google Tag Manager (GTM), you can use GTM's consent settings so the Blue Tracely tag only fires after a visitor has consented. Use this when your consent tool isn't CookieYes, because the Blue Tracely script doesn't read other consent tools by itself.

If your banner is CookieYes, you don't need this: the script follows the visitor's CookieYes choice by itself. See Using CookieYes Cookie Consent with Blue Tracely.

The steps inside GTM below follow Google's documentation. Menu names can change, so check Tag Manager consent mode support if something looks different.

Before you start

This guide assumes that:

  • your GTM container is installed on your website;
  • your consent tool is connected to GTM and updates GTM's consent state when a visitor accepts or declines;
  • you know the name of the event your consent tool sends to GTM when a visitor accepts. Your consent tool's documentation lists it.

If your consent tool doesn't update GTM's consent state, set that up first. GTM's consent checks only work when something updates the consent state.

Step 1: Open the Blue Tracely tag in GTM

  1. Open your container in Google Tag Manager.
  2. Go to Tags.
  3. Open your Blue Tracely tag. If you haven't created it yet, create a Custom HTML tag with your snippet, as described in Blue Tracely Install Guide for Google Tag Manager.
  1. In the tag, open Advanced Settings, then Consent Settings.
  2. Select Require additional consent for tag to fire.
  3. Add the consent type that covers advertising, usually ad_storage. Blue Tracely is advertising technology, so match the category your banner uses for advertising. If your consent tool uses its own consent type, use that instead.

GTM then doesn't fire the tag unless that consent type has been granted.

Step 3: Set the triggers

The tag still needs triggers that say when to fire.

Option A: All Pages

Use the All Pages trigger for visitors who already consented on an earlier visit. Their consent is known when the page loads, so the tag fires straight away. For visitors who haven't consented, the consent check holds the tag back.

For visitors who accept during their visit:

  1. Go to Triggers and create a new trigger.
  2. Choose Custom Event as the trigger type.
  3. Enter the event name your consent tool sends when a visitor accepts.
  4. Save the trigger and add it to the Blue Tracely tag.

Using both triggers is the safest approach: All Pages covers returning visitors, and the acceptance event covers new visitors who accept on the page. If both fire on the same page, the snippet runs only once.

Releasing the tag on the same page where the visitor accepts matters: the script can still report that page, and visitors who accept and leave aren't missed.

Step 4: Test before publishing

  1. Select Preview in GTM to open Tag Assistant, then open your website in the preview session. See Google's Preview and debug containers.
  2. Without accepting, check that the Blue Tracely tag hasn't fired.
  3. Accept on your banner and check that the tag fires.
  4. If it doesn't fire after you accept, check that your consent tool is updating GTM's consent state and sending the event your trigger expects.

To check the script itself, accept, open your browser's developer tools and type bluetracely in the console. After a few seconds, you should see an object listing loaded, assignIdentity and collect.

Step 5: Publish

When the tag behaves as expected, select Submit, then Publish. The change only reaches your website once the container is published.

Then, on the Script page, select Test script next to your domain. Accept the banner in the window the check opens, or on your site in the same browser first. See Verifying Your Script Installation.

GTM's Consent Initialization trigger is meant for tags that set up consent, such as your consent tool's own tag. Don't use it for the Blue Tracely tag.