Platforms

Google Tag Manager

Use allowedit with Google Tag Manager: where the script goes, how Consent Mode v2 defaults and updates reach your tags, and the allowedit_consent trigger.

allowedit works with Google Tag Manager in two ways. It sets Google Consent Mode v2 before any tag loads, so your Google tags respect the visitor's choice on their own. And it pushes an allowedit_consent event to the data layer, so you can fire any other tag only after the right consent.

Where the script goes

Put the allowedit script in your site's <head>, above the GTM snippet:

<head>
  <script src="https://allowedit.com/c/<siteId>.js"></script>

  <!-- Google Tag Manager -->
  <script>(function(w,d,s,l,i){ /* your GTM snippet */ })(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
</head>

Don't load allowedit from inside GTM. A tag inside a container runs after the container starts, which is too late to set Consent Mode defaults or to block trackers that load first.

The allowedit script sets Consent Mode defaults before the container starts, then sends an update when the visitor chooses. Google tags in your container (the Google tag, GA4 event tags, Google Ads and Floodlight) read those signals themselves, so you don't need extra triggers for them.

How the defaults work by region, which category maps to which signal, advanced and basic mode, and how to check it in Tag Assistant are all in Google Consent Mode v2.

Tags that don't understand Consent Mode (the Meta Pixel, TikTok, LinkedIn, Hotjar and so on) need a trigger. allowedit pushes this event every time consent is set or changed, and on each page load once a choice is stored:

dataLayer.push({
  event: "allowedit_consent",
  allowedit_preferences: "granted",
  allowedit_analytics: "granted",
  allowedit_marketing: "denied",
});

Open GTM's Preview mode and choose a banner option to see the exact event and its fields on your site.

Set up a trigger

  1. In GTM, go to Variables, then New, and create a Data Layer Variable named allowedit_marketing. Repeat for allowedit_analytics and allowedit_preferences if you need them.
  2. Go to Triggers, then New, and choose Custom Event. Set the event name to allowedit_consent.
  3. Set it to fire on Some Custom Events where allowedit_marketing equals granted.
  4. Attach the trigger to your marketing tags, and remove their old All Pages trigger.

Do the same with allowedit_analytics for analytics tags that don't use Consent Mode.

Check your setup

  1. Open GTM Preview and load your site in a private window.
  2. In the Consent tab of the first event, check the default state: denied for opt-in regions.
  3. Choose Accept all or Reject all on the banner. You should see allowedit_consent, then the Consent tab should show the update.
  4. Confirm your marketing tags fire only after marketing is granted.

You can also use Google's Tag Assistant to see the Consent Mode state of each Google tag.

Common problems

  • Defaults are "granted" or missing. Something else is setting Consent Mode defaults, often a snippet left from an old banner or a Consent Mode template in GTM. See the common mistake.
  • Tags fired before the update. The allowedit script is below the GTM snippet, or loaded by GTM. Move it to the top of the head.
  • Two banners. Remove any old consent tool's tag or template from your container.

More fixes are in Troubleshooting.

Still stuck? Email support@allowedit.com with your site's address and what you see.