Setting Up Google Consent Mode

phil rieley
5 mins
Written By  Phil
Published On Tuesday 4th June

Google Consent Mode allows you to adjust how Google tags operate based on user consent, guaranteeing compliance with privacy laws like GDPR. Setting it up integrates with your website's Consent Management Platform, allowing real-time tracking adjustments based on users' preferences. You'll configure your global site tags or Google Tag Manager to align with these consent signals. This feature helps maintain user trust and ensures that essential analytics can still be collected, albeit in a limited manner, respecting privacy preferences. Discovering more about its setup can lead to improved user engagement and compliance.

Understanding Google Consent Mode

Google Consent Mode V2 revolutionises how your website manages user data and cookies, guaranteeing compliance with privacy laws like GDPR. Configuring Google tags based on visitor consent status empowers you to uphold user privacy while maintaining valuable analytics insights. This tool works seamlessly with global site tags or Google Tag Manager and interacts effectively with your website's Consent Management Platform.

Implementing Google Consent Mode involves editing your website's source code to integrate these consent checks. This process guarantees that all Google services on your site, such as Google Analytics and Google Ads, adhere to the consent preferences set by your visitors. Whether a user consents to cookies or not, Google Consent Mode adjusts the data collection and processing activities accordingly, allowing for continued operation in a privacy-compliant manner.

The beauty of Google Consent Mode lies in its ability to balance compliance with data utility. You don't have to sacrifice analytics capabilities to meet legal standards. Instead, you can still gather essential metrics and perform site optimisations based on aggregated data from consenting users, ensuring that your digital marketing strategies remain robust and data-driven.

Importance of User Consent

Understanding the significance of user consent is essential for maintaining trust and compliance in today's digital landscape. As you navigate the complexities of online interactions, you must recognise that user consent isn't just a legal requirement; it forms the backbone of ethical data practices. By ensuring visitors can control their data, you're not only complying with laws like GDPR, but you're also building a foundation of trust.

When users trust your site, they're more likely to engage more deeply, providing the quality data that drives your business forward. Data-driven insights show that sites respecting user preferences tend to have lower bounce rates and higher engagement levels. Abiding with privacy laws isn't just about avoiding penalties but enhancing user experience and loyalty.

Moreover, transparent consent practices are essential for sustaining a positive brand image. In an era of skyrocketing privacy concerns, showing that you value user preferences can differentiate you from competitors. It's a strategic move that aligns with evolving consumer expectations and positions your brand as a leader in responsible data management. So, always prioritise precise, accessible consent mechanisms—they're critical to your site's success and integrity.

Key Features of Consent Mode

Let's explore the critical features of Consent Mode, which significantly modifies how your website interacts with user data based on their preferences. This powerful tool configures your Google tags to respect the consent choices of your users, ensuring compliance with GDPR and other privacy regulations. Consent Mode integrates seamlessly with your website's Consent Management Platform (CMP). This integration allows for real-time adjustments to tracking behaviours based on user consent. For instance, if a user declines to use cookies for analytics, Google tags will adjust accordingly, ceasing analytics data collection. This dynamic response ensures that your site respects user preferences without manual intervention.

Moreover, even when consent is not granted, Consent Mode enables essential measurement and modelling techniques. This means you can still gather important insights into website traffic and performance, albeit in a limited and privacy-compliant manner. It cleverly uses aggregate data to provide valuable analytics, ensuring you get all the critical information needed for effective decision-making.

Setting Up Google Consent Mode

To set up Google Consent Mode effectively, you'll need to integrate it with your website's existing consent management platform. This integration allows you to manage user consents effectively, ensuring that all Google tags on your site adhere to visitor preferences regarding data collection and personalisation.

Step 1: Preparing for Google Consent Mode

For Tag Manager Users: If you use Google Tag Manager and prefer to use your consent banner, you should load your banner through the Tag Manager container. This can be done by creating a consent mode template in Tag Manager or using one from the Community Template Gallery.

For gtag.js Users: Ensure the Google tag is installed on every website page. The consent mode code must be added to each page to function correctly.

Step 2: Setting Up Default Consent State

Before a user provides their consent, you need to set up a default consent state. This means setting up the initial consent configuration, which will apply until the user makes their choices known.

Here’s how to set default consent states using gtag.js:

// Define dataLayer and the gtag function.
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}

// Set default consent to 'denied' for all categories as an example
gtag('consent', 'default', {
  'ad_storage': 'denied',
  'analytics_storage': 'denied'

Before other tracking setup commands, this code should be placed on every site page. You should tailor the default settings according to the legal requirements of your site's regions, ensuring compliance and data accuracy.

Step 3: Updating Consent State Based on User Interaction

Once the user interacts with your consent banner and makes choices, you must update the consent state accordingly. This update should happen as soon as the user makes a decision.

Example of updating consent states when a user grants consent:



This function should be triggered by user interaction with the consent banner on your site. It’s essential to ensure that consent updates are carried across all pages the user visits.

Optional: Handling Asynchronous Consent Management Platforms

If your consent banner loads asynchronously, it might not always execute before your Google tags. To manage this, you can delay the sending of data:

gtag('consent', 'default', {
  'ad_storage': 'denied',
  'wait_for_update': 500 // waits 500 milliseconds


Step 4: Regional Specific Settings

You can also set region-specific consent settings to better tailor your site’s behaviour per geographic location:

gtag('consent', 'default', {
  'ad_storage': 'denied',
  'region': ['ES', 'US-AK']  // Example regions


Implementing Google Consent Mode is crucial for maintaining compliance and respecting user privacy. By setting up the correct consent configurations and responding dynamically to user choices, you can ensure your website operates legally and efficiently. Always stay updated with the latest from Google on changes to consent mode practices, especially in the European Economic Area.

Remember, setting up Google Consent Mode correctly is a legal requirement and a step towards building trust with your visitors by respecting their privacy preferences.

phil rieley
Written By  Phil
Share On: