21st June 2024

Implementing Consent Mode v2 on Shopify


Written By Willy Stewart

21st June 2024

Consent Mode v2 became mandatory for all websites which utilise Google platforms such as Google Analytics 4 or Google Ads, in March 2024. Shopify benefits from the upgrade to Consent Mode v2 as one of the benefits of the new version is the easier integration with content management systems.

You can learn in more depth about why it is important to implement Google Consent Mode and what the benefits and opportunities are below.

A Macbook pro with Shopify's consent banner settings on the screen.

How to Implement Google Consent Mode v2 on Shopify

In order to ensure you are compliant with the new Google Consent Mode v2 by March 2024, you will require;

  • Access to the Shopify liquid code OR permissions to add apps to the store
  • A Google Tag Manager (GTM) account
  • Up-to-date privacy policies

When using Google’s, now sunset but still useful, Tag Assistant extension for Chrome, none of the official Shopify app tags will appear until consent is granted.

Adding Scripts to the <head> of Your Website’s HTML Code in theme.liquid:
You require the consent state of your users to be updated dynamically, based on whether cookies are consented to or not as these parameters are selected. An example of this code could look like:

<script>
     function onUserConsentGranted() {
     gtag('consent', 'update', {
     'ad_storage': 'granted',
     'analytics_storage': 'granted'
     });
}
     CMP.on('consent-granted', onUserConsentGranted);
</script>

Adding The Script Through Shopify Apps

There are a range of Shopify apps which can integrate the new consent mode onto your site. Pandectas is the most popular which we have implemented on many sites.

Ensure Cookie Policies Are Displayed For Users to Accept or Decline

It is very important to ensure that users can actually accept or decline cookies on the site. This can appear as a standard cookie bar which appears on site when a user first accesses the site.

Shopify has a native option which has launched and allows Shopify store owners to add. Navigate to the Settings with Shopify, and scroll down to Customer Privacy. The 2nd option down on this window will allow the user to add a cookie banner. Set the regional visibility and customise the appearance - you can also choose the positioning it will take on your site.

If you would prefer to use an app for more significant design, options are available such as Cookiebot however at the very least, Shopify’s native option should be on (and is absolutely more than sufficient).

  • Create Tags and Triggers to Capture Consent in GTM
  • Create a Google Analytics Tag that is placed on all pages
  • Add a trigger which fires this tag only when ‘analytics_storage’ is fired

This Tag could look like:

{{analytics_storage}} equals granted

Updating Privacy Policy Details

Review your privacy policy to ensure your list of tracked cookies and platform integrations are listed. Proper compliance means being transparent with which cookies are being sent so users can find what they are accepting.

Other useful Shopify apps include Iubenda, which can dynamically generate your privacy policies from the platforms which exist on your site, therefore if you start, or remove, using Facebook Ads & Pixels on site, this will automatically update your documentation.

Checking Your Google Consent Mode v2 Implementation

You can confirm and verify your implementation of the new Consent Mode v2 by reviewing your property & data stream within GA4, checking your Consent Settings. You can also enter your debugging view in the preview tool on GTM which will show you whether you have ‘granted’ or ‘declined’ consent.

Contact Mucky Puddle For All Your Data & Tracking Needs

With the deadline for implementation of Consent Mode v2 now passed, it is hugely important that all website managers and digital marketers are following the new guidelines. If you are unsure, or need assistance implementing, feel free to drop us a message. Our team of expert digital marketers and Shopify developers have vast experience in conversion & event tracking along with user experience focused web builds.