Skip to main content

Documentation: Tag Manager plugin

YOOtheme Consent Manager

Tag Manager integrates with the YOOtheme Pro Consent Manager. When enabled, every tracking script injected by the plugin is blocked until the visitor accepts the matching consent category, and your trackers appear in YOOtheme's privacy settings dialog just like YOOtheme's own services.

You will find these settings in the YOOtheme Consent tab of the plugin.

Requirements

This integration requires YOOtheme Pro 5 with the Consent Manager enabled (in the YOOtheme customizer under Settings → Privacy). Leave the integration off if you use a different template or another consent solution; your trackers would otherwise stay blocked forever, because nothing would ever activate them.

How it works

  • Each tracking script is output with type="text/plain" and a data-category attribute, YOOtheme's standard mechanism for consent-gated scripts. The browser does not execute them until the Consent Manager activates them.
  • A script loads as soon as the visitor accepts one of its assigned categories (YOOtheme applies OR logic), whether via "Accept all", the category checkbox, or the individual service toggle.
  • The plugin registers its categories and services with the Consent Manager and adds them to YOOtheme's privacy settings dialog, including categories YOOtheme itself does not use. Labels and descriptions are translated automatically (English, Dutch, German, French, Spanish, Italian).
  • Site verification meta tags are never blocked; they contain no tracking.
  • Custom head/body code is left untouched. If you want your own snippets consent-gated, add type="text/plain" and a data-category attribute to them yourself.

Settings

Enable YOOtheme Consent integration

Master switch, off by default. With the switch off the plugin behaves exactly as before. Only enable it when the YOOtheme Pro 5 Consent Manager is active on your site.

Consent category (per tracker) One or more categories the visitor must accept before this tracker loads: Functional, Preferences, Statistics or Marketing. Sensible defaults are preselected: analytics tools (Google Analytics, Clarity, Matomo, Plausible) under Statistics, advertising pixels (Facebook, LinkedIn, Pinterest, TikTok, Microsoft Advertising, Leadinfo) under Marketing, and Google Tag Manager under both. Choose the categories that match what actually runs inside your GTM container.
Consent service ID Optional. Shows the tracker as an individually acceptable row in YOOtheme's privacy settings dialog, using YOOtheme's category.service notation (e.g. statistics.google_analytics). Prefilled with a sensible slug; use lowercase letters without spaces. Leave empty to show only the category, without its own row.

Consent-gating your custom code

The plugin deliberately leaves the three custom code fields untouched, but you can make your own snippets consent-aware with the same mechanism. Add two attributes to each `<script>` tag: `type="text/plain"` (so the browser does not execute it) and `data-category` with the required category. YOOtheme activates the script after consent.

An inline snippet in Custom Head Code:

<script type="text/plain" data-category="statistics">
(function(h,o,t,j,a,r){ /* tracking snippet */ })(window,document);
</script>

An external script in Custom Body End Code:

<script type="text/plain" data-category="marketing" src="https://widget.example.com/chat.js" async></script>

YOOtheme clones the whole tag on activation, so `src`, `async` and `defer` are preserved. If you want to be extra sure nothing prefetches the file, use `data-src` instead of `src`; YOOtheme turns it into `src` on activation. Multiple categories can be space-separated (`data-category="statistics marketing"`); note this is OR logic, the script loads as soon as either category is accepted.

Two caveats:

  • Use bare categories in custom code (`functional`, `preferences`, `statistics`, `marketing`). The `category.service` dot notation only works for services that are registered with the Consent Manager; an unregistered service identifier never receives consent. You may reuse a service ID that already exists, for example one of the plugin's own trackers or a service configured in YOOtheme itself.
  • Only `<script>` tags are activated. An `<iframe>` or tracking pixel `<img>` cannot be blocked with `data-category` directly; wrap it in a script that creates the element after consent:
<script type="text/plain" data-category="marketing">
var f = document.createElement('iframe');
f.src = 'https://example.com/embed';
document.getElementById('embed-here').appendChild(f);
</script>

What visitors see

The categories you use appear in YOOtheme's privacy settings dialog with a checkbox, a translated description, and one row per tracker with a service ID. "Accept all" and "Reject all" in the cookie banner cover the plugin's trackers as well. A tracker only starts after consent; consent already given can be changed at any time via the dialog (add a link with the URL #consent-settings to your footer, as YOOtheme recommends).

Tips and troubleshooting

  • A tracker does not fire after accepting: clear the yootheme_consent cookie (or test in a private window); a consent choice stored before you enabled the integration does not include the new categories yet.
  • All trackers stopped working after enabling the integration: the YOOtheme Consent Manager is not active. Enable it in the YOOtheme customizer under Settings → Privacy, or switch the integration off.
  • Verifying the setup: view the page source. Each tracking script should carry type="text/plain" and a data-category attribute before consent, and appear as a normal script after accepting.
  • Scripts that have already been loaded cannot be unloaded within the same page view; after a visitor withdraws consent, tracking stops from the next page load. This is standard Consent Manager behavior.