Google launched Google Consent Mode v2, emphasizing the significance of privacy for webmasters. It prioritizes privacy and has mandated cookie consent for websites to collect user data from the EEA region.
Websites serving in the EEA region must add consent mode v2 to collect data for Google Ads, Analytics, and other services.
In this blog post, we cover Google Consent Mode v2 for Magento 2, including how to implement it.
What is Google Consent Mode v2?
Google Consent Mode (GCM) ) is a privacy feature that enables webmasters to manage user preferences for Google services.
Consent Mode v2 is an enhanced version of its predecessor, designed by Google to meet current privacy requirements, particularly for users in the EEA region. It necessitates explicit user consent for personalized ads and analytics. To implement this, Google introduced two new consent types: ad_user_data and ad_personalization.
To collect these consents efficiently, we use consent management tools. When users visit a Magento store, a cookie consent bar appears. This bar lets visitors allow or deny consent. Their choice informs Google Consent Mode v2 about using personal data for ads and analytics.
Why Magento 2 Users Should Care About Consent Mode v2?
In Magento 2, Google Consent v2 builds an equilibrium between respecting user privacy and data collection. Here are some reasons to implement Google Consent Mode v2:
- Respect User Privacy: Obtaining consent demonstrates that businesses respect user privacy and allow users to control their personal data. This ensures data is collected and used only with user agreement.
- Legal Compliance: Data protection laws in many regions require user consent for data collection. Regulations such as GDPR in the EU and CCPA in the US mandate that businesses secure user consent before collecting or using their data.
- Build Trust: Being transparent about data collection practices and seeking user consent builds trust. Users are more likely to engage with businesses that are clear and honest about their data usage.
- Improve Data Collection Efficiency: Google services like Ads and Analytics may not collect user data without consent signals from the EEA region. You can add consent mode v2 to streamline data collection with user consent.
Offering insights into campaign effectiveness and user behavior patterns enables businesses to make informed choices while upholding user trust.
How to Add Consent Mode v2 in Magento 2?
You can manually add cookie consent for Magento v2 by creating a module that stores user preferences and interacts with Google tags. For this, you need to have some development and coding knowledge or hire a professional developer.
One easy option is to use a ready-made extension for Google Consent Mode v2 Magento 2. By performing a few simple steps, the solution can help you comply with the privacy laws and streamline your data collection in your existing analytics (via GTM or gtag.js) setup.
Here’s how you can add cookie consent mode v2 using Meetanshi’s extension:
Step 1: Install Magento 2 Consent Mode V2
First, download the extension zip file and extract it to your Magento root directory. Log into your SSH and run these commands step by step:
- php bin/magento setup:upgrade
- php bin/magento setup:static-content: deploy –f
- php bin/magento cache:flush
Once done, the Google Consent Mode extension for Magento 2 will be successfully installed.
Step 2: Customize Cookie Banner
Now go to your Magento Admin Panel, navigate to Stores > Configuration > Meetanshi > Cookie Consent v2, and enable the extension.
Here you can start customizing the cookie banner.
The cookie preferences button helps users to update their preferences any time after setting them. You can choose to show or hide this button and change its background color.
You can also design the cookie notice displayed to users, with the following options:
- Notification Text: Enter the text to be displayed in the cookie notice when a customer first visits the website.
- More Information Link: Provide a link to your cookie policy page, which contains detailed information about the cookies your site uses.
- Consent Restriction Timeline: Specify the number of days for which the cookie consent preferences will be stored. The cookie notice will reappear to visitors once the preferences expire.
The section also lets you customize the buttons such as the Accept, Decline, and Set Custom Preferences buttons.
Step 3: Edit Cookie Groups & Consent Banner
Once the Consent Mode v2 extension is enabled, you can start collecting these default consents:
Cookie Group | Consent Types (Parameters) |
Essential | – |
Advertisement | ad_storagead_user_dataad_personalization |
Analytics | analytics_storage |
These parameters represent all the necessary consent types required to collect data for Google’s services. These content types can be added to the group and when interacting with your eCommerce website customers can allow or deny a specific cookie group.
Also, you can edit the default consent types offered by the Magento 2 cookie consent extension or create new ones.
To edit the default consent types or create a new one navigate to Cookie Consent V2 > Manage Cookie Groups.
You can set the cookie group as essential (meaning users can’t deny it), and add its name, code, and description.
Once done, click the Save Group button.
Similarly, you can assign consent types to the group you created. You can define parameter code, and default status (i.e. granted or denied) and assign it to a cookie group.
On the front end, the users can set their preferences for cookie groups. Meaning, that the consent status of all parameters included in that specific group will change when users accept or deny a specific group.
Once you’re done with the configuration, the consent popup will appear on the front end.
When a user visits your site for the first time, they will see a consent notice where they can manage their preferences. The updated consent status is communicated to Google tags via the data layer. Users can choose to accept all cookies, only the necessary ones, or set custom preferences to allow specific cookie groups.
After users have made their selections, the consent notice will not reappear until the expiration period configured in the extension.
You can also monitor the consent preferences set by users from the Admin panel > Cookie Consent V2 > Cookie Consent Logs.
Summary: Google Consent Mode v2 for Magento 2
User privacy is the future – online businesses should understand this. Consent Mode v2 by Google is a significant move towards a privacy-centric digital world. If you’re selling or have site visitors from the EEA or the UK region, you should add Magento 2 consent mode v2 to your site.
For this, Meetanshi’s extension for Consent Mode v2 is the easiest and fastest option. It helps you keep you stay compliant with Google’s privacy requirements for data collection.