
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.