How to Set Up a Compliant Magento 2 Cookie Consent

Close
Read time
7 mins
Published
Nov 30, 2026
Share

  • Website owners should configure Magento 2 cookie consent to comply with GDPR and similar data privacy regulations.
  • You can use a native Magento cookie banner as a placeholder on your store. You can also use it if you don’t target European visitors or share personal data with third-party tools for marketing and analytics.
  • Most websites need a Magento 2 cookie consent extension to bring a consent banner UI up to GDPR requirements and effectively block third-party scripts before consent.
  • A consent management platform (CMP) like Cookiebot by Usercentrics helps websites configure cookie consent collection and block cookies before consent in a GDPR-compliant way.

Magento 2 has its native cookie restriction mode that adds a basic cookie notice. But GDPR compliance for your Magento store requires extra effort and additional protection measures. This guide covers configuration details and privacy compliance differences between two options: a native Magento cookie banner and a consent management platform like Cookiebot by Usercentrics for your Magento store.

If you’re a Magento store owner, you need to know that your website sets its pre-built cookies on your website visitors’ browsers. Also, some third-party tools you use for marketing and analytics can set their own cookies. That’s a big problem if you need to serve visitors in Europe. It's also a problem if you don’t ask their permission to comply with the European Union’s General Data Protection Regulation (GDPR).

This guide shows why you need a cookie consent banner and what a native Magento cookie notice can cover. It also shows why you need additional tools like Magento 2 cookie consent extension or a consent management platform (CMP) to mitigate legal and reputational risks.

Whenever your website targets people located in Europe and/or collects personal data from shoppers for marketing purposes that involve third-party tools, you need to inform those website visitors about your cookie practices. On top of a cookie notice, you need to ask for permission to comply with the EU data privacy regulations. This permission is consent. Thus the notice is a cookie consent banner.

Tracking cookies are small files websites place in their visitors’ browsers to collect data about their online activities. The exact pieces of information they store range from language preferences to past Google searches. This depends on the data collection purposes, technical capabilities, and your website’s privacy policy.

Not all the cookies websites use require visitor consent under the ePrivacy Directive and GDPR requirements. You might not need to ask for permission for saving items in a shopping cart, as such cookies are essential to website functionality. But third-party cookies, sensitive personal data, and information you use for content personalization or behavioral marketing do need visitor consent.

Learn more about the difference between data privacy and data security on your website.

Which Cookies Magento 2 Sets Out of the Box?

Magento 2 sets pre-built cookies for core functionality of a website (“exempt” cookies) along with “non-exempt” cookies that let website owners track preferences and behaviors of their visitors. Though “non-exempt” cookies improve the shopping behavior, they require visitor consent before launching under the ePrivacy Directive and GDPR requirements.

  • PHPSESSID: Basic tracking of visitor session or authentication.
  • form_key: The basic security mechanism on Magento that prevents Cross Site Request Forgery attacks (CSRF).
  • guest-view: Lets you connect a guest order on your website with a visitor who made it but hasn’t created an account.
  • login_redirect: Lets your website save the page your website visitor visited after they register on the website.
  • private_content_version: Assigns a random number and time to pages with customer content so they are not cached on the server.
  • store: Tracks the specific store views or locale that the website visitor has selected.

Based on Adobe documentation, Magento sets 35 exempt cookies (as of September 2026). Most of them are essential to maintain system stability. Exempt cookies mostly don’t require consent, as they support the smooth shopping experience on your Magento website.

Whenever your Magento store sets cookies for marketing, analytics, personalization, or behavioral tracking, GDPR and the ePrivacy Directive consider this as additional functionality. This functionality requires visitor consent. Data privacy regulations classify cookies by purpose, not by name. Thus, a cookie isn’t automatically compliant just because it’s labeled as essential.

If you deploy product recommendations modules or install third-party trackers for advertising and analytics purposes, including Google Analytics, Adobe Analytics, Meta Pixel, and Hotjar, you need to add a cookie notice. You must also ask for visitor consent before running those scripts under EU privacy laws.

As a Magento store owner, you should be clear about the reasons why you set cookies. This helps determine privacy compliance, or whether they are essential or additional for website functionality.

Native Magento tools let website owners enable a cookie restriction mode and set a cookie notice. A cookie banner from Magento informs your website visitors about cookie usage. It also adds an “Allow Cookies” button to give consent to this.

Here is how you can configure a native Magento cookie banner in your website’s Admin sidebar:

  • Go to Stores. In Settings, choose Configuration.
  • In the General menu on the left, choose Web.
  • Expand the Default Cookie Settings section to adjust cookie lifetime, path, and domain.
  • Set Cookie Restriction Mode to Yes, and don’t forget to Save Config to make the changes work.

Native Magento tools are very limited in configuration and customization. The basic setup lets website owners change only:

  • The duration for a customer’s session cookies
  • Specific directories on your server where a cookie is accessible
  • The domain that is allowed to access the store’s cookies


The native Magento 2 cookie notice misses several key elements to support GDPR compliance.

A Magento cookie banner may not meet GDPR cookie consent requirements because it’s a basic notice with limited functionality. Magento native tools don’t block third-party scripts before consent, offer granular controls, or store consent trails ready for external audits.

To reach GDPR compliance, you need to introduce a consent management platform (CMP). It is designed to generate a cookie policy, introduce a GDPR-compliant cookie consent banner, block third-party scripts, and store consent choices.

Based on GDPR consent requirements (Art. 7 GDPR), website visitors should give their consent freely, based on a detailed cookie disclosure. They should also find it easy to give and withdraw it later. Art. 4(11) GDPR also defines consent as specific and unambiguous. This means that visitors should get separate choices for separate purposes (also known as granular controls).

Check out the full list of GDPR compliance requirements for websites

Compared to a native Magento banner, a GDPR-compliant notice should:

  • Include full disclosure of cookie practices on the website and purposes of data collection.
  • Let website visitors clearly see “Allow all” and “Deny” options, along with options to specify consent for certain purposes.
  • Confirm that the consent choices affect data collection on your website, and no third-party scripts run before visitor consent is received.


To support GDPR compliance, you need to rely on alternative methods other than Magento native tools.

As of September 2026, GDPR fines for data privacy noncompliance can reach up to EUR 20 million or 4 percent of a company's total global annual turnover. 

Pre-loaded trackers before visitor consent are a frequent reason for violation under national cookie laws (such as a EUR 150 million fine for SHEIN by France’s CNIL in 2025). Another frequent reason is dark patterns that complicate withdrawing consent.

ToolProsCons
Native Magento tools (cookie notice in the cookie restriction mode)- Easy to install  - Adds a basic cookie notice- Too weak for GDPR compliance  - Don’t block third-party scripts before consent
Free Magento 2 cookie consent extension- Can configure in Magento admin  - Mostly provides a GDPR-compliant cookie banner only- May not block third-party scripts before consent  - Doesn’t impact the overall GDPR compliance of a business
Managed CMP- Advanced features for overall GDPR compliance- May require manual setup to Magento  - Usually subscription-based
Custom build- Maximum flexibility and control over GDPR compliance- Requires manual setup and extra resources to implement

Why Your Magento 2 Website Needs a CMP for GDPR Compliance?

A Magento 2 store requires a CMP because its native cookie restriction mode falls short of GDPR standards:

  • It doesn’t block third-party tags like Google Analytics, Hotjar, or Meta Pixel before the visitor gives consent.
  • It offers only a single “Agree” button, or at most a binary “Yes”/”No” choice.
  • It doesn’t store any consent proof for regulators.


Given its limitations, a native Magento banner is rather a placeholder before you integrate a CMP with a dedicated Magento 2 cookie notice extension. Otherwise, you risk facing GDPR fines. You also risk losing trust from your visitors once they find out that their consent choices do not really change anything on your website.

Compared to Magento 2 cookie notice extensions, Cookiebot by Usercentrics supports Magento stores as they scale. It offers features for your GDPR consent lifecycle management. Cookiebot CMP helps you stay privacy-compliant across multiple privacy laws.

On top of getting a customizable, GDPR-compliant cookie banner, Cookiebot by Usercentrics provides you with:

  • Geotargeting and regional adaptation: Cookiebot CMP identifies the physical location of website visitors to tailor the banner and the language. This is designed to meet data privacy regulation requirements in that jurisdiction (including GDPR, CCPA, LGPD, and more).
  • Regular tracking audits: Cookiebot CMP runs regular, automated scans to help find cookies, tracking pixels, and hidden scripts on your Magento store and provides actionable insights.
  • Cookie policy generator: Get an automatic cookie policy. You can adjust it and add it to your privacy policy for data privacy compliance and stronger visitor trust.
  • Storing consent logs: Cookiebot CMP stores consent choices in the cloud, ready for external audits from EU authorities.

To start using Cookiebot CMP, you need to disable the native cookie restriction mode on Magento. Then, follow the setup instructions for manual configuration.

Frequently asked questions

No, Magento 2 websites are not GDPR compliant by default. Using a native Magento cookie banner is not enough to reach GDPR compliance either. 

Website owners may need an additional cookie consent extension or a Consent Management Platform (CMP) to manage consent effectively. The right solution should prevent non-essential cookies and third-party tracking scripts from running before consent is obtained, give visitors granular control over their preferences, and maintain consent records to help demonstrate compliance during audits.

You can enable Magento's built-in cookie notice directly from the Admin panel. To do this, go to Stores → Settings → Configuration. Under General, select Web. Expand the Default Cookie Settings section and set Cookie Restriction Mode to Yes. Save your configuration and refresh any invalidated caches when prompted.

Alternatively, you can install a third-party cookie consent extension or integrate a CMP.

If you use Cookiebot by Usercentrics, you'll need to follow itsMagento installation guide. Magento uses RequireJS, which conflicts with Cookiebot's automatic cookie-blocking feature. As a result, Cookiebot requires manual implementation in Magento, including configuring scripts to respect visitors' consent choices.

You can also follow Cookiebot'sthree-step manual implementation guide for general setup instructions.

Yes, you can use Magento's native cookie notice, but its functionality is limited. It doesn't offer comprehensive consent management for all cookies and tracking technologies.

If your store only uses strictly necessary cookies, Magento's native functionality may be sufficient. However, if you use analytics, advertising or other non-essential tracking technologies that require consent, you'll need an additional solution, such as a Magento 2 cookie consent extension or a dedicated CMP, to manage visitor preferences and prevent tracking before consent.

Magento 2 uses several cookies and local storage technologies by default to support core website functions, such as shopping carts, user sessions and security. These include PHPSESSID, form_key, mage-cache-sessid, add_to_cart, guest-view and login_redirect, among others. Adobe provides a full list of default cookies and storage technologies.

While cookies needed for essential website functions don't require prior consent, analytics, advertising and other non-essential tracking technologies generally do. This applies to both first-party and third-party technologies.

The auto-blocking in Cookiebot CMP doesn't support RequireJS, so Magento 2 setups typically require manual script tagging instead. It doesn’t necessarily mean that you need to hire a developer in practice. 

The support documents will guide you on where to insert the pre-made code snippet templates. However, for most Magento 2 stores, some developer involvement can significantly facilitate the installation process.

If you run several websites or stores in one Magento installation, you can share consent via the same root domain or separate domain groups. Cross-domain sharing may be possible under the CMP like Cookiebot by Usercentrics. The exact choice depends on your domain structure, user experience, and privacy compliance risks.