Magento 2 Google Consent Mode v2: Integration, Setup, and Extensions

Magento 2 Google Consent Mode v2 allows online stores to connect visitors' cookie preferences with Google services. The mode uses consent signals to tell Google if it can process data for analytics, advertising, and personalised ads. This is especially important for Magento stores selling to customers from the EU and the UK since they require merchants to use Consent Mode v2.

This guide describes why Magento 2 Cookie Consent Mode v2 is important, how to connect it to a store, and how to test if it works.

Key Takeaways
  • Magento doesn't include Google Consent Mode v2 by default. 
  • There are three ways to configure Google Consent Mode v2 in Magento 2: via an extension (quick and cost-effective option for most setups), a Consent Management Platform (CMP), or a custom solution.
  • Consent Mode v2 includes ad_user_data and ad_personalization consent signals, which Google needs for EEA and UK traffic.
  • Without ad_user_data and ad_personalization consent signals, some Google Ads features like remarketing and conversion measurement may become less accurate or stop working.
  • When linking your cookie consent banner with consent signals, make sure ad_storage, analytics_storage, ad_personalization, and ad_user_data are set to "Denied" before Google tags load. This ensures that tracking won't start before visitors make their cookie choices.
  • Use Magento 2 Cookie Consent and Magento 2 Google Tag Manager extensions by Magefan for faster and easier Consent Mode v2 integration. They both work smoothly together to connect your cookie banner with Google tags based on visitors' choices.

Google Consent Mode is a feature that tells Google services whether each website visitor store allows cookies and tracking. The original Google Consent Mode uses two main consent signals:

  • ad_storage — controls the use of advertising cookies used for measuring ad performance and tracking conversions
  • analytics_storage — controls the analytics cookies used for measuring website traffic and understanding visitors' behaviour 

Magento doesn't offer this functionality out of the box. Its default cookie banner neither sends users' choices to Google nor controls how Google uses tracking based on these choices.

You can configure Magento 2 cookies using a third-party extension, a CMP, or through a custom setup. Then, when someone visits your store for the first time and accepts cookies on your cookie banner, Google Consent Mode sends that choice to Google through consent signals.

If visitors reject cookies, the signals tell Google that cookies are not allowed. As a result, Google may stop certain types of tracking or track only basic information that doesn't identify the person.

However, ad_storage and analytics_storage cover only basic consent requirements. To have more control over how visitors' data is used for advertising, Google released Consent Mode v2. 

Why Do You Need Google Consent Mode v2?

Consent Mode v2 is a new version of Google Consent Mode with two additional consent signals that Google now requires when targeting users in the EEA and UK. Besides ad_storage and analytics_storage signals, it also includes ad_user_data and ad_personalization:

Signal Description
ad_storage Defines if Google advertising cookies can be stored.
analytics_storage Defines if Google Analytics can store cookies to track website visits and activity.
ad_user_data Defines if visitor information can be sent to Google to show ads.
ad_personalization Defines if visitor data can be used to show personalised ads and support remarketing.

In short, with Consent Mode v2, you can legally comply with privacy laws and run effective Google Ads campaigns. 

Difference Between Google Consent Mode v1 and Google Consent Mode v2

 The main difference between Google Consent Mode v1 and Google Consent Mode v2 is that v2 adds two more consent signals for advertising and remarketing and has been required for the EEA since 2024.

The table below describes the differences between Google Consent Mode v1 to v2 in more detail.

Feature Consent Mode v1 Consent Mode v2
Consent signals

ad_storage

analytics_storage

ad_storage

analytics_storage

ad_personalization

ad_user_data

Default consent Set by you. If no state is set, tags assume consent EEA/UK merchants must configure the default consent state to "Denied" before the tags load.
Why it was introduced To help websites adjust tracking based on users' consent choices To add more control over advertising data and personalisation as required for EEA/UK traffic since March 2024 under the DMA, alongside GDPR and ePrivacy.
Impact if missing Websites have fewer options for managing consent signals Remarketing audiences and conversion measurement for EEA/UK users stop working or become less accurate in Google Ads.
Setup options Can be implemented with different tag and consent configurations Basic mode: Google tags are blocked until consent is given. Advanced mode: Google tags can send limited, cookieless signals when consent is denied.
Magento 2 support Requires an extension or custom solution Requires an extension or custom solution that supports all v2 signals.

Since Magento 2 doesn't offer any of this by default, choosing a solution that covers all four v2 signals is the most reliable way to make your store compliant and keep your advertising data accurate.

To handle user consent, Magento works together with several elements: cookie notice, consent signals, Google Tag Manager, and Google tags. Each one has its own task to do.

Helper What it does Example on your store
Cookie notice Asks visitors what they allow to collect and gather their choices The Accept all/Reject/Accept Specific popup that appears when someone opens your store.
Consent signals Four on/off settings that carry the choices If the visitor rejects advertising, ad_storage is set to "denied" and so on.
Default and update commands No data is sent to Google (when everything is off). Update changes it after the visitor chooses Default: sets all signals to denied when the page loads. Update: "analytics granted" after the visitor clicks Accept.
Google Tag Manager Holds your tracking tags and checks the signals before running them It sees "ads denied" and stops the Google Ads tag from running.
Google tags (Analytics, Ads) Do the actual tracking, but only as far as the signals allow The Analytics tag counts the visit only if analytics is allowed.

When a visitor is loading your online store, your site tells Google services: "There is somebody who hasn't decided yet, so refer to all consent as denied." Then, depending on how Google tags are set up, they follow one of these steps:

  • tags wait, and the consent is given (basic mode)
  • tags load but send only anonymous signals, with no cookies and no personal data (advanced mode)
Note: Advanced mode gives you better reporting but is harder to defend in an audit. Basic mode is a more cautious choice. Decide with your legal adviser which option is better in your case.

Now, depending on the options visitors have chosen on your cookie consent banner, Google does the following:

  • Accept all (four signals set to granted) — Google Analytics and Google tags track visitors normally.
  • Reject all (four signals stay denied) — Cookies are not stored. Yet, in Advanced mode, Google gets anonymous pings.
  • Analytics only (analytics_storage signals are granted, ad signals are denied) — Analytics tracks visitors, but your Google Ads account doesn't see them as remarketing targets and doesn't show them your ads on other sites.
  • Advertising only (ad_storage, ad_user_data, and ad_personalization are granted, analytics_storage signal is denied) — Google can use advertising cookies for personalized ads, ad measurement, and remarketing.
  • Change their mind (a new update is sent) — the new choice applies from that moment on.

If you enable the optional signal (either functionality_storage or security_storage), they change together with the four main ones, based on the cookie groups they are linked to.

Default Magento cookies vs Google Consent Mode v2

Default Magento also collects its own cookies — cookies for sessions, shopping carts, and other store functions. It includes a built-in feature called Cookie Restriction Mode, which you can enable in Stores > Configuration> General > Web > Default Cookie Settings.

The default mode shows a cookie notice and holds back non-essential cookies until visitors press the Allow Cookies button.

enable cookie restriction mode magento

Even though it's a useful start, the default setup has its limitations. It doesn't control Google Analytics and Google Ads or pass the visitors' choices to Google.  

Criteria Magento Cookie Restriction Mode Google Consent Mode v2
Purpose Shows a cookie notice and restricts Magento cookies Tells Google tags what the visitor has agreed to
Consent choices A single "Allow cookies" choice Four seperate signals: ad_storage, analytics_storage, ad_personalization, ad_user_data
Communication with Google None Sends consent states to Google tags (Analytics, Ads, and others)
Effect on Google tags None Tags adjust their behavior to match the consent state
GTM integration No integration by default Yes, through GTM consent settings and Consent Initialization triggers

In other words, Cookie Restriction Mode controls which cookies Magento can store internally, while Consent Mode determines how Google tags behave.

Therefore, if you sell to EEA or UK customers and run Google Ads or Analytics, Cookie Restriction Mode is not enough. You need a Consent Mode v2-compatible banner that sets consent signals by default and updates them after visitors have given consent.

As it was mentioned above, a Magento cookie notice doesn't send consent signals to Google by default. Yet, there are two extensions that support Consent Mode v2 and help you close that gap — Magefan's Magento 2 Cookie Consent and Magefan's Magento 2 Google Tag Manager.

Cookie Consent extension

Magento 2 Cookie Consent Extension by Magefan supports Google Consent Mode v2 in Magento and allows merchants to create, collect and manage visitors' consent through a customizable cookie banner with different cookie groups.

magefan cookie consent banner

It's designed to publish the default consent state on the page before Google tags read it and update all signals when a visitor makes a choice.

magento cookie consent banner

Moreover, the extension is not tied only to Google. It works with any tracking or marketing service you use (TikTok Pixel, Meta Pixel, etc.). It becomes a helpful option for stores with several tracking services that want one banner to manage consent for all of them.

Google Tag Manager extension

Magento 2 Google Tag Manager by Magefan allows you to connect your store with Google Tag Manager, Google Analytics 4, and Google Ads directly from the Magento admin panel via the ready-made GTM data layer. It supports Google Consent Mode v2 and Magefan Cookie Consent, so your tags run only after your visitors have given permission. 

With Magefan extensions, setting up Google Consent Mode v2 in Magento and consent tracking takes only a few minutes. You only need to switch on the Google Consent Mode v2 option in both extensions.

Step 1: Configure Google Consent Mode for cookie consent

Go to Stores > Configuration > Magefan Extensions > Cookie Consent > Google Consent Mode v2 and enable Google Consent Mode v2 to make the extension publish visitors' consent choices for Google through the required signals.

Note: Set the default status of all signals to Denied. This is what Google and GDPR expect for visitors from the EEA and the UK. 

enabling magento google consent mode v2

Step 2: Configure Google Consent Mode v2 in Google Tag Manager

Google Tag Manager reads consent signals and decides which tags can run based on visitors' cookie choices. It integrates smoothly with the Cookie Consent extension and shares the same consent signals without extra tools or code.

To enable Google Consent Mode v2 in Google Tag Manager Extension, go to Stores > Configurations > Magefan Extensions > Google Tag Manager and Analytics > GDPR/CCPA/LGPD and Enable Google Consent Mode.

enabling consent mode v2 in gtm

Once configured, both Cookie Consent and Google Tag Manager extensions set up the following consent process on your website:

  1. Visitors enter your store.
  2. Cookie notice pops up.
  3. Visitors choose what permissions to give.
  4. Consent status is stored.
  5. Tracking tools get the corresponding consent signals.
  6. Tags behave according to the given consent.

If visitors change their choices, the extensions update the consent signals accordingly.

To check whether Consent Mode v2 works correctly in your Magento store, use the Preview mode in the Google Tag Assistant. It allows you to see if consent signals change according to visitors' cookie choices. To get started, do the following:

1. Go to your GTM container and open the GTM Preview mode.

Preview Google Tag Manager

2. Enter your store URL.

Connect tag assistant to your website

3. Check if all Consent Mode v2 signals are set to Denied (default consent state) before interacting with the cookie banner on your website.

magento default cookie consent state in gtm preview

4. Accept all cookies on your banner and check if all signals change to Granted.

magento granted consent state in gtm preview

5. Reject all cookies and confirm they are all set to Denied in Preview mode.

magento denied consent state in gtm preview

6. Choose specific cookie categories and check if corresponding consent signals are updated.

denied magento analytics cookies in gtm preview

Note: clear your browser cookies or open a new incognito window when checking each consent signal. This way, your previous consent choices won't affect the results, and you will be able to see if Consent Mode v2 responds to each choice correctly.

However, if you notice that a tag fires when it shouldn't, check whether the default consent is set to "Denied" and if the tag has the right consent requirements in GTM Extension config.

Even though Magento doesn't provide Google Consent Mode v2 compatibility out of the box, it still leaves you a way to add it quickly and without complex custom development.

Magefan Cookie Consent extension helps you to cover the collection and delivery of visitors' consent. The GTM extension makes sure your Google tags follow these choices. Together, they help you meet consent requirements under GDPR, Google's EEA and UK rules.

FAQs

collapsible icon
A server has no access to the visitor's browser automtically, it only knows what the browser or code tells it. It doesn't check consent on its own. So if you do not configure your setup to pass the visitor's choices to the server, events will be sent no matter what choices your visitors clicked on the banner.
collapsible icon
Magento 2 Google Consent Mode v2 sends visitors' consent choices to Google services. However, it doesn't make your store fully GDPR compliant. You must also manage cookies, provide consent choices, and let users control their data according to applicable privacy laws.
collapsible icon
The Magefan Cookie Consent extension offers consent storage for both registered customers and guests. Just go to Stores > Configurations > Magefan Extensions > Cookie Consent > Cookie Consent Log and enable consent logging along with the retention period. You can review the records under Marketing > Cookie Consent > Log.
collapsible icon
Magento Cookie Restriction Mode is a default Magento feature that requests consent before Magento stores cookies, while Google Consent Mode v2 sends consent signals to Google tags to adjust their behaviour according to the given consent. The Magefan Cookie Consent extension helps manage cookie preferences and connect them with Google Consent Mode v2.