WeltPixel Google Consent Mode V2 Main Image

Google Consent Mode V2 for Magento 2

Getting your store ready for the future of privacy: Google Consent Mode v2

What is Google Consent Mode v2?

Google Consent Mode is a mechanism through which your users' Cookie or app identifier consent status is communicated to Google. Google tags will then adjust their behavior and the information they send through based on the consent status.

Consent Mode, upon receiving the communicated consent status, dynamically adapts the behavior of Analytics, Ads (as well as some 3rd-party) tags that create or read browser cookies. This allows Google to use advanced modelling to fill in the gaps when data isn't available, providing you a better and more accurate experience across Google Services.

Why do you need to use Google Consent Mode v2?

Ultimately, it's all about making sure that user privacy choices are respected, however, starting with March 2024, Google has determined Consent Mode v2 to be a requirement for websites that use Google Services in the European Economic Area (EEA). These changes and requirements allow you simultaneously respect privacy choices, while also ensuring Google's conversion and behavioral modelling can substitute the lack of data and continue providing a unified data experience.

How does Google Consent Mode v2 work?

Essentially, Google Consent Mode requires setting a default consent state for a few Google-specific parameters (usually denied) when a user first accesses the website. Afterward, a consent banner or popup is displayed, which allows the user to customize (deny or accept) their consent towards Google's parameters. When the user interacts with the banner, the consent state is updated and communicated to the Google Tag Manager container. The tags in the container then adapt their behavior based on the signals provided. In short, the process is:

  1. Set up a consent banner
  2. Set the default consent state (usually denied)
  3. Update the consent state as the user interacts with your banner

Google does not provide a consent banner/popup that can be used, so the onus is on the merchant to implement this. This can be done via a Cookie Management Platform (which handles the acceptance/rejection of cookies in general) or via a custom functionality through which a banner or popup is displayed. If you already have a Cookie Management Platform/Solution implemented, there's a good chance it's been updated for compatibility with Google Consent Mode v2, in which case you can explore Google's documentation to find out whether Consent Mode is properly implemented.

What does the WeltPixel Google Consent Mode v2 for Magento 2 extension do?

The purpose of this extension is to ensure merchants can implement Google's Consent Mode v2 on their website with minimal effort, friction and customization. Essentially, the module fulfills the implementation by setting a default consent state and allowing merchants to display a form (either via popup or Magento Widget) that users can interact with to update the consent state and communicate this information to Google Tag Manager.

This extension is targeted and intended for merchants that do not have an existing Cookie Management Platform/Solution and that do not intend to implement one. It's important to note that the extension is not a full-fledged Cookie Management Platform and only serves to set and update Google's specific Consent Mode v2 parameters. It works with an existing Google Tag Manager implementation and, for best results, is recommended to be used with our Google Analytics 4 (GA4) extension.

Features of the Extension.

  • Ensures website compliance with Google Consent Mode v2.
  • Possibility of displaying Consent Form via a traditional Popup or via an insertable widget for increased flexibility.
  • Ability to group consent parameters for UX simplicity.
  • NEW: Ability to control popup or widget toggle default position to reduce friction and need for customer interaction.
  • Custom labels for consent parameter groups.
  • Full compatibility with the Google Analytics 4 extension.

1 MINUTE INSTALLATION GUI.

  • Step 1.

    Before starting the installation:

    • Ensure your Magento version is compatible - This extension is currently compatible with the following Magento versions: 2.3.0. - 2.4.7-p3.
    • Install the extension on a testing/development/staging environment first, then, after thoroughly testing it out, install it on a production (live) environment.
    • Make sure the Magento instance is in developer mode. You can use the php bin/magento deploy:mode:set developer command to change the mode to developer and then check to make sure the generated folder in the root of the Magento project is empty.
  • Step 2:
    Copy the extension files to below paths of your magento 2 instance. If the ‘app/code/WeltPixel’ folder is missing, please create it manually:
    app/code/WeltPixel/Backend
    app/code/WeltPixel/GoogleConsentModeV2


  • Optional
    Copy the extension files into the below path of your Magento 2 instance. If the ‘app/code/WeSupply’ folder is missing, please create it manually:
    app/code/WeSupply/Toolbox

  • Step 3:
    Copy the installation GUI folder 'weltpixel-extension-installation' in the root of your Magento installation. In some Magento configurations the public root folder may be under 'pub' directory.
    www.yourmagentostore.com/weltpixel-extension-installation/
  • Step 4:
    In your browser go to www.yourmagentostore.com/weltpixel-extension-installation/ and simply follow the installation steps from the graphical interface, presented in your browser.
  • Step 5:
    If your store was in production mode before starting the installation, make sure to switch it back to production mode by running the following command in the root of your Magento installation: php bin/magento deploy:mode:set production.
  • Step 6:
    Wooohooo! The extension is now installed on your Magento store! Congrats!

Troubleshooting

If you experienced any issues or limitations with this quick GUI installation, see also SSH Installation below. SSH installation does the same thing, but you are required to issue the commands step by step via CLI. Some servers may have high security configurations and may limit the functionality of this GUI Installer.

How to Install via SSH.

  • Step 1.

    Before starting the installation:

    • Ensure your Magento version is compatible - This extension is currently compatible with the following Magento versions: 2.3.0. - 2.4.7-p3.
    • Install the extension on a testing/development/staging environment first, then, after thoroughly testing it out, install it on a production (live) environment.
    • Make sure the Magento instance is in developer mode. You can use the php bin/magento deploy:mode:set developer command to change the mode to developer and then check to make sure the generated folder in the root of the Magento project is empty.
  • Step 2.
    Copy the extension files to below paths of your magento 2 instance. If ‘app/code/WeltPixel’ folder is missing, please create it manually:
    app/code/WeltPixel/Backend
    app/code/WeltPixel/GoogleConsentModeV2


  • Optional
    Copy the extension files into the below path of your Magento 2 instance. If the ‘app/code/WeSupply’ folder is missing, please create it manually:
    app/code/WeSupply/Toolbox

  • Step 3.
    Access the root of your magento 2 project from command line and run the following commands:
    php bin/magento module:enable WeltPixel_Backend --clear-static-content
    php bin/magento module:enable WeltPixel_GoogleConsentModeV2 --clear-static-content
    php bin/magento setup:upgrade
    php bin/magento setup:di:compile
    php bin/magento setup:static-content:deploy -f
  • Step 4.
    Flush any cache that you might still have enabled on your server or in Magento.
  • Step 5:
    If your store was in production mode before starting the installation, make sure to switch it back to production mode by running the following command in the root of your Magento installation: php bin/magento deploy:mode:set production.
  • Step 6:
    Wooohooo! The extension is now installed on your Magento store! Congrats!

How to Upgrade the extension.

  • Step 1.
    Remove the extension code under app/code/WeltPixel/GoogleConsentModeV2 before adding the new extension files. The extension may be refactored and old unused files may cause random issues, so it's best to only keep the latest version of the files.
  • Step 2.
    Follow the normal installation instructions above.

Magento Marketplace Installation.

GOOGLE CONSENT MODE V2 FOR MAGENTO 2 EXTENSION SETTINGS.

  • Enable Google Consent Mode - Set this option to Yes to enable the Google Consent Mode V2 integration. To use this extension, you'll need a Google Tag Manager integration. The module is designed to work with our Google Analytics 4 extension, but should work fine with other integrations, provided the Google Tag Manager initialization script is loaded after the Google Consent Mode default state is set by this extension.
  • Enable Url Passthrough - URL Passthrough ensures information that's passed to your website via URL query parameters is sent to Google in cases in which ad_storage is denied. More details can be found in Google's Consent Mode V2 documentation.
  • Default Consent Toggle Position [ Checked / Unchecked ] - Choose whether you want the toggle position to start checked or unchecked. Checked is recommended to reduce friction and the need for customer interaction.
  • Display in a popup - Choose whether to display the Google Consent Mode widget in a popup, similar to a Cookie Banner. The popup will be displayed when the user first accesses the store, and can be closed at any time. If the user closes the popup without updating their settings, the default "denied" consent state is used. If you want to offer users the possibility of reopening the popup, you can add the wp-consent-popup-open class to an element that is accessible anywhere on the store, for example, a Footer Link. Once the element is clicked, the popup will reopen and the user can modify their consent settings.
weltpixel
weltpixel
  • Popup Heading - Choose the heading text to be displayed on the Google Consent Popup.
  • Popup Description - Choose the description text to be displayed on the Google Consent Popup.
  • Group Consent States - If set to Yes, the consent states are split into two groups - Marketing, Analytics & Personalization, containing Ad Storage, Ad User Data, Ad Personalization, Analytics Storage, Personalization Storage and Functionality & Security, containing Functionality Storage, Security Storage. The end user will see two toggles on the frontend.
  • Marketing, Analytics & Personalization Group Label - Choose the label for the Marketing & Analytics group toggle. If no value is specified, "Marketing, Analytics & Personalization" is used.
  • Functionality & Security Group Label - Choose the label for the Personalization & Storage group toggle. If no value is specified, "Functionality & Security" is used.

Change Log.

What’s new in v.1.14.9 - November 26, 2024

  • Adjusted the script tag the extension uses to ensure its scripts stay in the head section when Move JS to Bottom functionalities are used. The tag now uses a data-attribute.
  • Added minor Magento Admin adjustments to the module status section for increased clarity and compatibility with server-side Social Pixel addons.


What’s new in v.1.14.7 - October 11, 2024

  • Compatibility: Introduced compatibility with the latest Magento 2.4.7-p3, 2.4.6-p8, 2.4.5-p10 and 2.4.4-p11 versions, which come with critical security adjustments for the platform. Magento 2 merchants are urged to upgrade to the latest patches ASAP.
  • Added various code updates for increased security around the licensing functionality as well as the Help Center and WeltPixel Developer Magento Admin sections.


What’s new in v.1.14.3 - June 20, 2024

  • Compatibility: Introduced compatibility with the latest Magento 2.4.7-p2, 2.4.6-p7, 2.4.5-p9 and 2.4.4-p10 versions, which come with critical security adjustments for the platform. Magento 2 merchants are urged to upgrade to the latest patches ASAP.


What’s new in v.1.14.1 - April 19, 2024

  • Fixed a bug that would sometimes cause the Consent Mode V2 popup to appear on the frontend even when the extension was disabled in the Magento Admin.
  • Confirmed compatibility with the latest Magento 2.4.7 release, as well as newly released 2.4.6-p5, 2.4.5-p7 & 2.4.4-p8 Security Patches.
  • Confirmed compatibility with PHP 8.3 on the Magento 2.4.7 release. PHP 8.2 is also supported for this Magento version.
  • Added security improvements to the Backend module's license verification process.


What’s new in v.1.10.1 - March 28th, 2024

  • Initial release.


WeltPixel Change Log