Search
Close this search box.

Documentation

In this article

Consent Mode

You can now enable Google Consent Mode for Tag Manager. How it works, and what you need to configure can be found here.

Download

You can also directly download the demo container with triggers and variables/ Please make sure you know how to import a container.

In this category

Categories

Recent articles

Adding Global site tag (gtag.js) with Granular Consent

Complianz will add the Global Site Tag (gtag.js) when you configure the Wizard to use Google Analytics (Wizard > Consent > Statistics), and select that you wish Complianz to place the Analytics script on your website (Wizard > Consent > Statistics – configuration).

But in some cases you may want to implement gtag.js manually, allowing you to modify the type of consent that is required for certain parts of the script to be loaded.This article elaborates on how to add gtag.js, while controlling consent granularly between script tags. For Tag Manager, please follow this link.

This article consists of three steps.

  1. Configuring the Wizard
  2. Adjusting gtag.js for consent – This can also be used for Google Analytics 4
  3. Adding it to your website

1. Configuring the wizard

In the wizard, under Cookies – Statistics, you will need to choose between the following answers:

  • Yes, but not with any of the above services – Choose this if you’re in the EU, do not target Germany or Austria, and have configured Analytics for GDPR. This answer will set Google Analytics before consent.
  • Do you want to ask consent for statistics? – Choose accordingly, whereby the UK will always need consent and some countries based on the configuration.

2. Adjusting gtag.js for consent

A gtag.js can be downloaded and appended to with other tags;

The additions are as followed;

For each category we choose which part of the script can be fired, and what to adjust:

This is also possible with async, but deferring these scripts should be done with care, as they are dependent on each other. Testing this cross-browser is advised, because deferred script might fall back to async in some situations, creating false positives.

3. Adding it to your website

This is a personal preference, but Google states adding this between your tags on your website. This is either done in your header.php or with a plugin like Header Footer Code Manager. You can use the above code to start and append and adjust where necessary.

Join 800.000 users and install The Privacy Suite for WordPress locally, automated or fully customised, and access our awesome support if you need any help!