How to Install Consent Mode v2: Step-by-Step Guide

How to Install Consent Mode v2: Step-by-Step Guide

Table of Contents

Implementing Consent Mode v2 is crucial for ensuring compliance and optimizing your website’s performance. In this guide, we’ll walk you through the installation process, troubleshooting common issues, and customizing settings for Consent Mode v2.

What is Consent Mode v2?

Consent Mode v2 is a tool that helps your website comply with privacy laws. It adjusts how Google services work based on whether your visitors agree to share their data. This means it respects your visitors’ choices about data collection.

When someone visits your website, Consent Mode v2 checks if they have given permission for their data to be collected. If they haven’t, it makes sure that Google services only collect the necessary data without using personal information. This helps you stay compliant with laws like the General Data Protection Regulation (GDPR).

Why Use Consent Mode v2?

Follow Privacy Laws

Privacy laws like GDPR require websites to get permission from visitors before collecting their data. Consent Mode v2 helps you follow these laws by adjusting data collection based on user consent.

Accurate Data

When visitors agree to share their data, Consent Mode v2 ensures that the data collected is accurate and reliable. This helps you make better decisions based on the data.

Build Trust with Visitors

When visitors agree to share their data, Consent Mode v2 ensures that the data collected is accurate and reliable. This helps you make better decisions based on the data.

Better User Experience

Consent Mode v2 helps you manage cookies and trackers on your website. This means that users who do not give consent won’t be tracked unnecessarily, leading to a better browsing experience.


Before you start, ensure you have:

Step-by-Step Installation Guide

For a very detailed, step-by-step guide complete with images, similar to the ones shown in the video, you can click the link: Detailed Step-by-Step Instructions with Images

Step 1: Create a GTM Container for Your Website

  1. Sign in to Google Tag Manager (GTM): Go to Google Tag Manager.
  2. Create a New Container: Click on “Create Account,” fill in your account name, container name (your website), and select “Web” as the target platform. Click “Create.”

Step 2: Install GTM on Your Website

  1. Get the GTM Code: Once your container is created, you’ll see two snippets of code.
  2. Add the Code to Your Website:
    • CMS Plugin: If you’re using a CMS like WordPress, install a GTM plugin and paste the container ID.
    • Manual Installation: Add the first code snippet to the <head> section and the second snippet to the <body> section of your HTML.

Step 3: Install the CookieHub Cookie Consent GTM Template

  1. Get the Template from CookieHub: Log in to your CookieHub account and go to the dashboard to get your CookieHub code.
  2. Add the Template to GTM:
    • In GTM, go to “Templates” and click “Search Gallery.”
    • Search for “CookieHub” and add the template to your workspace.
  3. Configure the CookieHub Tag:
    • Create a new tag in GTM and select the CookieHub template.
    • Paste the CookieHub code you got from the dashboard into the tag configuration.
    • Add the Consent Initialization – All Pages trigger.

Step 4: Preview Changes to Verify the CookieHub Setup

  1. Enter Preview Mode in GTM: Click on “Preview” in the GTM dashboard to enter preview mode.
  2. Check Your Website: Open your website in a new tab. You should see the CookieHub consent banner displayed.

Step 5: Inspect the Preview Events

  1. Verify Consent Mode Variables: Select the “Consent Default” event in the Summary and go to the Consent Tab, check that the Consent Mode v2 variables, ad_user_data and ad_personalization, are present and correctly configured.

Step 6: Publish the Changes

  1. Submit Your Changes in GTM: Once everything looks good, go back to GTM and click “Submit.”
  2. Publish and Create a Version: Fill in the details for your version and publish the changes.

Common Issues and Troubleshooting

Issue 1: Script Not Loading

Solution: Ensure that the script is placed in the correct section of your website HTML file. Verify that there are no errors.

Issue 2: Incorrect Consent Status Before Cookie Banner Interaction

Solution: Make sure that the CookieHub Tag in GTM has the desired default consent status. And make sure that the regional consent type is correctly setup in the CookieHub dashboard, read further about this issue in our documentation.

Issue 3: Google Ads/Analytics Cookie Less Pings Not Sent Before Consent.

Solution: Make sure that the GTM Additional Consent is not added to Google Ads/Analytics Tags that have Built-In Consent. See how to get an overview of the Tags Consent setup here.


Installing Consent Mode v2 is a crucial step in ensuring compliance and optimizing your website’s data collection. By following this guide, you can implement Consent Mode v2 efficiently and troubleshoot common issues that may arise.

For more detailed information, you can refer to the CookieHub Installation Guide and the Easy Guide to Google Consent Mode v2.

By implementing Consent Mode v2, you demonstrate a commitment to user privacy and data accuracy, which are essential in today’s digital landscape

Sales & Support