How to Enable Consent Mode in Google Analytics 4

Cody Schneider8 min read

New privacy regulations like the Digital Markets Act (DMA) are changing how we track data, making it essential to get user consent before your Google tags fire. Google Analytics 4 Consent Mode is the bridge between respecting user privacy and still getting valuable data. This guide breaks down exactly how to enable it, what it does, and how to confirm it’s working correctly.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

What is Google Analytics 4 Consent Mode?

At its core, GA4 Consent Mode is a feature that adjusts how your Google tags (like your Google Analytics and Google Ads tags) behave based on the consent choices your website visitors make. It doesn't collect consent itself - you still need a cookie banner for that. Instead, it "listens" for the user's decision and tells your tags how to respond.

When a user visits your site, they give - or deny - consent for different types of data collection through your cookie banner. Consent Mode uses this signal to operate.

It works with several consent types, but the main ones for analytics and advertising are:

  • analytics_storage: Controls storage related to analytics, like Google Analytics cookies.
  • ad_storage: Governs storage related to advertising, such as Google Ads cookies.
  • ad_user_data: Manages consent for sending user data to Google for advertising purposes.
  • ad_personalization: Controls consent for personalized advertising (remarketing).

How It Works When Consent is Granted vs. Denied

This is where Consent Mode is especially useful. It has two primary operational states based on user choices:

When Consent is Granted: If a user clicks “Accept All,” your Google tags function normally. They fire as usual, set cookies on the user's browser, and collect detailed, user-level event data for your GA4 property.

When Consent is Denied: If a user clicks “Deny” or ignores the banner, Consent Mode sends "cookieless pings" to Google Analytics instead. These pings are anonymous, aggregated pieces of information that contain no personal identifiers. They let GA4 know that a user was on the site and took certain actions (like a page view or conversion) but without using cookies or identifying the individual user.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

The Magic of Behavioral Modeling

This "cookieless pings" data is the key. Once you have enough of it, Google activates Behavioral Modeling for Consent Mode. Using machine learning, Google analyzes the behavior of users who did grant consent and applies those patterns to estimate the behavior of users who denied consent. This process closes the gap in your data, giving you a more complete and accurate picture of your website's performance while still respecting user privacy. You get modeled conversions and session data right inside your standard GA4 reports.

Before You Start: What You Need in Place

Before you can enable Consent Mode, you need two essential things set up first.

1. A Cookie Banner (Consent Management Platform)

This is the most critical component. Google Analytics does not provide a cookie banner or a way to ask users for permission. Its role is only to receive the consent signal. Therefore, you need a third-party tool known as a Consent Management Platform (CMP) to handle this.

A CMP is the tool that presents the cookie banner to your users, records their consent choices, and then passes that information to Google tags. Popular CMPs that integrate easily with Google products include:

  • CookieYes
  • Cookiebot
  • OneTrust
  • Usercentrics
  • Complianz

Most reputable CMPs have built-in integrations for activating Google Consent Mode, making the process much easier.

2. The Google Tag or Google Tag Manager

Consent Mode works by communicating with your Google tags. Your site must have either the global site tag (gtag.js) installed directly on its pages or be running Google tags through Google Tag Manager (GTM).

How to Enable GA4 Consent Mode: Step-by-Step

There are two primary ways to set up GA4 Consent Mode: by using a certified Google CMP partner (the easiest method) or by implementing it manually. For most businesses, using a CMP is the recommended path.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Method 1: Using a Consent Management Platform (The Easy Way)

The simplest way to enable Consent Mode is to use a Google-certified CMP. These platforms are designed to connect with Google’s ecosystem seamlessly.

  1. Choose and Install a CMP: Sign up for a CMP like CookieYes or Cookiebot. You'll typically get a JavaScript snippet to add to the <head> section of every page on your website. Make sure this script loads before your Google Analytics tag.
  2. Configure Your Cookie Banner: Customize your consent banner’s design and text to match your brand and comply with regulations like GDPR. Ensure it clearly provides options to accept or deny cookies.
  3. Enable the Google Consent Mode Integration: Inside your CMP’s dashboard, look for an option in the settings related to "Integrations," "Google Consent Mode," or "Compliance." Most CMPs have a simple toggle or checkbox to activate it. Turn this on.

That's often it! Once enabled, the CMP will automatically communicate the user's consent status to your Google tags without you having to write any code.

Method 2: Manual Implementation with gtag.js (The Custom Way)

If you have a custom-built cookie solution or need more direct control, you can implement Consent Mode manually by adding code to your website. This approach requires adding a default consent state snippet and then an update command that fires when a user makes a choice.

Step 1: Set the Default Consent State

First, you need to tell Google tags the default consent state that should apply before a user has made any selection. To be compliant with regulations, you should set everything to denied by default.

Add the following JavaScript code snippet to every page of your website. It must appear before your Google Analytics (or GTM) script.

<script>
  // Define the default consent state.
  window.dataLayer = window.dataLayer || [],
  function gtag(){dataLayer.push(arguments),}

  gtag('consent', 'default', {
    'analytics_storage': 'denied',
    'ad_storage': 'denied',
    'ad_user_data': 'denied',
    'ad_personalization': 'denied',
    'wait_for_update': 500  // Optional: waits 500ms for an update
  }),
</script>

This code ensures that no cookies are set or personal data is collected until the user explicitly opts in.

Step 2: Update Consent When the User Makes a Choice

Next, you need to connect your cookie banner’s buttons to fire a consent update command. When a user clicks "Accept," you need to send a signal to Google that updates the consent state to granted.

The JavaScript function that runs when a user accepts cookies should include this gtag() command:

function userGaveConsent() {
  gtag('consent', 'update', {
    'analytics_storage': 'granted',
    'ad_storage': 'granted',
    'ad_user_data': 'granted',
    'ad_personalization': 'granted'
  }),
}

Make sure this function is called when your "Accept All" button is clicked. If a user denies consent, you don't necessarily need to fire an update, as the state will remain denied from the default you set.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

How to Verify Your Consent Mode Implementation

After setting everything up, you absolutely must verify that it’s working correctly. Nothing is worse than thinking you're compliant when you're not.

1. Use Google Tag Assistant

The easiest way to check your setup is with Google's debugging tool.

  • Go to tagassistant.google.com.
  • Enter your website URL and click connect. A debug version of your site will open in a new window.
  • In the Tag Assistant window, look for the Consent tab.
  • On the initial page load, you should see the On-Page Default status for all consent types set to Denied.
  • Now, go to the debug version of your site and click "Accept All" on your cookie banner.
  • Go back to the Tag Assistant window. You should see a new "Consent" event in the event history. The status for your consent types in the On-Page Update column should now be Granted.

2. Check Browser Developer Tools

You can also check the network requests your website is sending to Google.

  • Open Chrome, navigate to your website, and open Developer Tools (Right-click > Inspect > Network tab).
  • Interacting with the website when a consent state is "denied" will trigger signals that contain a gcs parameter with a value starting in G10. For example gcs=G100. The first digit represents analytics consent, and the second advertising. gcs=G100 is deny, deny.
  • When you grant tracking consent — "accept" on a cookie banner — the collected signals for user actions will add another parameter gcs beginning in G11. For example gcs=G111. gcs=G111 is grant, grant.

If you see these signals firing correctly based on the choices you make on the banner, your Consent Mode is likely configured properly.

Final Thoughts

Setting up Google Analytics 4 Consent Mode is no longer an optional task for businesses that take data privacy and regulatory compliance seriously. By using a certified CMP or implementing it manually, you can both respect user choices and leverage Google's behavioral modeling to maintain a more complete view of your website's performance.

Once your consent data is flowing accurately into Google Analytics, the challenge often shifts to making sense of it all. Many marketing and sales teams spend hours each week manually exporting GA4 data into spreadsheets to build reports and find insights. We created Graphed to remove this friction entirely. You can connect GA4 and your other data sources in seconds, then ask for dashboards and reports in plain English, allowing you to get answers in real time without waiting on anyone.

Related Articles