A cookie content banner is a green flag for visitors and data protection regulators.
In this tutorial, learn how to add cookie banner to a Magento 2 site and get helpful resources to work effectively with them.
Why Do You Need Cookie Banner in Magento 2?
Data privacy and user transparency are the core reasons to add a cookie banner.
Cookie consent for Magento 2 banner helps you make your visitors feel safe about their data and also your store to adhere to the laws.
In addition, Google has made it mandatory to collect consent for user data tracking. Meaning, you need to take users’ consent for using their data on personalized ads on Google.
Use Free Magento 2 Cookie Notice Extension by Meetanshi
You can use the free Magento 2 Cookie Notice extension to implement cookie consent on your site. It allows you to show a cookie consent notification on your website, where the visitor can accept or deny the usage of cookies.
In a few simple settings, you can set the banner, its content, cookie expiration date, and overall design.

If the user accepts, the non-essential tags load and start tracking user behavior and collecting data. In the other case, all the scripts and tags are blocked.
This simple Magento 2 site cookie banner is not compatible with Google Consent Mode v2. Which is required if you want to track users’ data for ads and marketing from the EEA and the UK region.
How to Implement Google Consent Mode v2 in Magento 2?
You can use Google Consent Mode v2 to create a lightweight cookie banner to collect actionable data from your visitors. It helps you collect and send users’ consent to Google via Tags, so that you can track data effectively.
In simple terms, it helps you take permission from the EEA & UK users to collect data for advertising and marketing purposes.

You can set up Google Consent Mode v2 and customize it in the following ways:
- Set the style, color, text to display in the banner and important links
- Create cookie groups and assign different consent parameters to them
- Log users’ consent preferences from the backend admin panel
On landing, the users can choose to accept or deny all the consents through a banner. They can also choose their preferences for each type of cookie group (through a popup as shown below)

Then, the selected user preferences are sent to Google via Tags. Google then uses this information to offer you tracking data that you can use for marketing and ad campaigns.
Implementing this cookie banner in Magento 2 gives visitors the flexibility to select cookie groups they feel comfortable with and get essential data without violating privacy preferences.
You have a distinctive advantage, which is not possible in a typical cookie banner; when the visitor doesn’t give consent, you can’t track anything.
Unlock insights while staying within the privacy boundaries
Unlock NowNormal Cookie Banner vs Consent Mode v2
Both allow you to take users’ consent, but they differ in their purpose and how they work.
Elements | Normal Cookie Banner | Consent Mode v2 |
Purpose | Collects user consent for cookies for legal compliance | Helps you collect users data for marketing and advertisement on Google’s services |
Analytics Impact | Partial data collection (e.g., aggregated), even if users deny consent | Stay within privacy realms but comes with a risk of losing all data if consent is not given |
Anonymous data collection | It doesn’t collect any data, even anonymous, if consent is rejected | Collects less data without using any user’s personal details like events, page views, etc. |
Privacy realms | Stay within privacy realms but comes with a risk of losing all data if consent not given | Complies with privacy laws and collects conversion tracking and other essential analytics data |
Set up cookie banner Magento 2 using the Consent Mode v2 approach refines the process and offers flexibility to both the parties (you and your website visitor), if you want to go beyond the traditional approach.
Create a Balance With Cookie Banner
Adding a cookie banner to your Magento 2 website is easy, but which one to pick is the question.
While one gets the job done in the most basic way possible, and the other comes with advanced features to lawfully use customer data in a more user-friendly format.
And in today’s time, customization is always the way to go.
The latter strikes a balance between consent and tracking without making anything unhappy, which seems like a fair win.
Unlock insights while staying within the privacy boundaries
Unlock Now