Google Consent Mode V2 Integration
In order to implement the new Google Consent Mode V2 integration for the Consentmo GDPR Compliance app, follow the below steps. Please note that this integration is working for all Consentmo GDPR app users and you can set this regardless of the plan you are running for our app. If is avaialble for the Free plan users as well.
Automatic Settings Google tags and GCM V2 via Consentmo
Open Shopify Admin.
Click on Online Store link in the left menubar.
Click on the Actions dropdown button and select Edit Code from there.
A new page will open with a list of files on the left side of the screen.
Create a new liquid file in the Snippets section of the theme files, called gcm-integration-script
After that copy the content of the integration script provided below and paste it in the newly created Snippet file:
Download Google Consent Mode V2 Integration script
Open the theme.liquid file.
Locate the opening <head> tag and right after it, add the following line of code:
Note: The line of code should be placed right after the opening <head> tag as the Google Consent Mode needs to be executed before the other tracking services (Google Tag Manager, Google Ads, etc.).
The final result should look like this:
NOTE: Make sure to remove the added code before deleting the app. This way, no snippets of code will be left in your theme. For more information on what you should be aware of when deleting our app check this article of our FAQ page.
Once this is done, the integration of the Google Consent Mode with our app will be successfully set in your store.
For further information on how our app works with Google Consent Mode, continue reading the text below:
Before consent:
These are the default settings that the page will use while waiting for the user’s consent status to be given.
When your customers visit your store, the integration we provided will initially run the default settings and populate the parameters in the dataLayer to granted or denied depending on how the option Initial State Of The Cookie Bar is set.
By default, the integration script we provide is set to block all categories and all the parameters will be set to denied. If you want to change this as per your preferences please refer to the information on the different initial states in the script file, as shown here:
After consent:
Then, there are the update settings that are sent as soon as consent has been given.
After that, when your store visitor gives his consent by accepting the Cookie bar, the updated settings will set the parameters to granted or denied depending on which cookie categories the visitor chooses to block. If no cookie categories are blocked, the Google services will set their cookies to the visitor's browser.
As a general recommendation, it would be best to check and address the steps for overall store compliance, listed in the below article as well:
* Setting your store's compliance
Testing the integration with Google Consent Mode V2
In need of any assistance with the setup, do not hesitate to drop us a line at support@consentmo.com or via our Live chat.
In case you want to make this integration automatically and load all your Google tags from our app settings, so they can integrate with the Google Consent Mode V2, please refer to the article below:
Automatic Settings Google tags and GCM V2 via Consentmo
The process for initial manual integration for Google Consent Mode V2, is the following:
Open Shopify Admin.
Click on Online Store link in the left menubar.
Click on the Actions dropdown button and select Edit Code from there.
A new page will open with a list of files on the left side of the screen.
Create a new liquid file in the Snippets section of the theme files, called gcm-integration-script
After that copy the content of the integration script provided below and paste it in the newly created Snippet file:
Download Google Consent Mode V2 Integration script
Open the theme.liquid file.
Locate the opening <head> tag and right after it, add the following line of code:
<!-- Google Consent Mode V2 Consentmo -->
{% render 'gcm-integration-script' %}
Note: The line of code should be placed right after the opening <head> tag as the Google Consent Mode needs to be executed before the other tracking services (Google Tag Manager, Google Ads, etc.).
A reference on the process can also be checked here:
The final result should look like this:
NOTE: Make sure to remove the added code before deleting the app. This way, no snippets of code will be left in your theme. For more information on what you should be aware of when deleting our app check this article of our FAQ page.
Once this is done, the integration of the Google Consent Mode with our app will be successfully set in your store.
For further information on how our app works with Google Consent Mode, continue reading the text below:
Google Consent mode has two variants.
Before consent:
These are the default settings that the page will use while waiting for the user’s consent status to be given.
When your customers visit your store, the integration we provided will initially run the default settings and populate the parameters in the dataLayer to granted or denied depending on how the option Initial State Of The Cookie Bar is set.
By default, the integration script we provide is set to block all categories and all the parameters will be set to denied. If you want to change this as per your preferences please refer to the information on the different initial states in the script file, as shown here:
After consent:
Then, there are the update settings that are sent as soon as consent has been given.
After that, when your store visitor gives his consent by accepting the Cookie bar, the updated settings will set the parameters to granted or denied depending on which cookie categories the visitor chooses to block. If no cookie categories are blocked, the Google services will set their cookies to the visitor's browser.
As a general recommendation, it would be best to check and address the steps for overall store compliance, listed in the below article as well:
* Setting your store's compliance
In order to test the integration once you complete the above steps, please refer to the guide we have for this in the below article:
Testing the integration with Google Consent Mode V2
In need of any assistance with the setup, do not hesitate to drop us a line at support@consentmo.com or via our Live chat.
Updated on: 16/10/2024
Thank you!