How to install Google Tag Manager in compliance with GDPR

Attention: Pro Features
This type of Cookie is supported only in the Pro and Reseller versions of My Agile Privacy. Purchase your license and gain access to the entire database of pre-inserted cookies, constantly updated by the experts at My Agile Privacy.
>> Click here and find the plan that suits you best.

Google Tag Manager simplifies the management of various third-party analytics and marketing tools. It’s important to remember that, in addition to configuring Google Tag Manager itself, you need to declare and manage cookies for each third-party tool connected via Tag Manager (for example, “Google Analytics”).

Let’s see how to install GDPR-compliant Google Tag Manager on your WordPress site using the My Agile Privacy plugin.

Solution 1 – Automatic Scan

You can use the advanced "Cookie Shield" feature, which will automatically detect Google Tag Manager.
Simply set the Shield to "Learning" mode and browse your site’s pages; your configuration will be ready.
If you prefer, manual configuration is also available.

Solution 2 – Manual Configuration

Part 1 – Locating Your Google Tag Manager Code

First, locate the Google Tag Manager code in your Tag Manager dashboard.
It should look like this:

Part 2 – Adding the Google Tag Manager Cookie in My Agile Privacy

In your WordPress admin, go to My Agile Privacy → Cookie List.
Here, you’ll see a list of cookies imported during plugin installation. By default, they are in draft status; publish only those cookies relevant to your website.

The cookie list will show several columns, including:

  • Cookie Name: the name of the cookie.
  • Is Necessary: indicates if the cookie is essential for your site’s operation. If not accepting the cookie breaks your site, it is marked as essential (pre-filled).
  • Auto Update: shows if the cookie’s reference text is kept updated automatically for GDPR compliance. If set to "yes," the texts update automatically.
  • Installation Type: the method by which the cookie is added. This may change depending on your setup and requirements.

To add Google Tag Manager, search for "Google Tag Manager (Google, Inc.)" in the list and click on it.
The detail page will contain pre-filled informational text and two blank fields for code. This text appears in your cookie policy and will be kept up to date if "Allow Automatic Update" is enabled.
Below, select the "Type of Installation" (Javascript and Noscript, or Raw). Keep "Javascript-noscript code" selected and two fields will appear:

  • Javascript Activation Code – where to enter the main Google Tag Manager code
  • NoScript code – where to enter any <noscript> code

Part 3 – Adding the Google Tag Manager Code

Now, copy your Google Tag Manager code and paste it into the appropriate fields according to the example above.
Remember to enter the code without the opening and closing <script> and </script> tags for the JavaScript field, and without the <noscript> tags for the NoScript field.
Don’t forget to save and publish the cookie by clicking the blue "Publish" button in the upper right corner.

Part 4 – Verifying Google Consent Mode v2

To ensure full GDPR compliance and proper operation of Google Tag Manager, make sure that Google Consent Mode v2 is active and correctly configured on your site.
You can find a step-by-step guide here: how to implement Consent Mode V2 on your website.

Final Step – Verifying Correct Operation

To check that Google Tag Manager is installed and configured correctly, use Google’s verification tools or the tools for any third-party scripts you have set up in Tag Manager.
If you need further assistance, feel free to contact us.

Download the free guide

Fill out the form and get immediate access to the guide in PDF format.
Mockup del pdf della guida
Loading in Progress...
Request successfully sent. You will be redirected to the download page shortly
By submitting this form I declare that I have read the privacy policy and authorize the Owner to respond to me for what is expressed in point a of the privacy policy
Warning: Your Cookie choices may not allow the form to be submitted.
Click here to review your preferences.
buy now My Agile Privacy - compliant in less than 3 minutes
a Formula Agile SRL project
COE / TAX ID 31366
Via Tre Settembre, 99 - 47891 Dogana - San Marino - RSM
Share capital 26'000€
For assistance: info[at]myagileprivacy.com
GDPR and privacy present complexities that extend beyond achieving website compliance. Compliance obligations span across all business aspects and necessitate expert analysis.
When it comes to implementing Banners and Policies, trust My Agile Privacy—the only solution that excludes unnecessary implementations not mandated by regulations.
Logo CMP partner GoogleLogo CMP partner GoogleLogo CMP partner GoogleLogo IAB Europe approvedLogo IAB Europe approved