Configuring GTM Tags for Cookie Consent

Configuring GTM Tags for Cookie Consent

To control which cookies are set by third-party scripts (tags) managed via Google Tag Manager (GTM), we need a way to selectively disable or enable these tags. We refer to this method as “Exception Triggers”, which allow control over the availability of any tag based on specific conditions.

We provide the snippet “Webmercs-consent-manager-GTM-snippet.json”, which includes pre-configured triggers for all supported cookie categories: “marketing”, “performance”, “functional”, and “other”. When one of these triggers is applied to a tag, the tag will only be enabled if the corresponding category is explicitly activated in the Webmercs Cookie Manager on the webshop.

Every script tag that is not essential to the webshop’s functionality should use an appropriate exception trigger based on its type. For example, since Hotjar is a marketing script, its tag should use the “Webmercs cookie consent - marketing disabled” exception trigger. This ensures that the Hotjar tag remains disabled on the webshop until a user explicitly enables it via the Webmercs Consent Manager. Additionally, the “Cookie declaration” page on the webshop lists all scripts that use cookies along with their respective purposes (https://<webshop>/pages/cookie-declaration).

Step 1 - Import configuration

  • Navigate to the “Admin” tab and select the “Import Container” option.

  • Choose the file “Webmercs-consent-manager-GTM-snippet.json” and choose the “Merge option.

  • Click the “Existing” button to import the configuration into an existing workspace.

  • Click the “Confirm” button.

This process will create a folder named “Webmercs cookie consent” and import four triggers and two variables into it.

 

Step 2 - Set Exception Trigger for Custom Tags

  • For any tag containing tracking, performance, or marketing scripts, open the dialog to add a new trigger.

  • Click the “Add exception” button.

  • Select the appropriate trigger preconfigured by Webmercs - for example, for a marketing script, choose the “Webmercs cookie consent - marketing disabled” trigger.

  • The trigger will be added as an exception, preventing the tag from loading if the corresponding cookie category is disabled by the user.

  • Click the “Save” button to apply the changes.

  • Repeat these steps for any specialized tag (such as Hotjar) or any “Custom HTML” tag containing a script.

 

Final Step – Verification and Maintenance

After configuring all the required triggers and variables, thoroughly test your GTM setup to ensure that all cookie consent exceptions are functioning as intended. Verify that tags remain disabled when their corresponding cookie category is not enabled, and that they activate only when a user explicitly consents via the Webmercs Consent Manager. This final verification is essential for ensuring regulatory compliance and maintaining a seamless user experience.