DEV Community

Cover image for Google Consent Mode v2: Implementation Checklist for WordPress, Shopify and Custom Websites
IntelligenceX
IntelligenceX

Posted on

Google Consent Mode v2: Implementation Checklist for WordPress, Shopify and Custom Websites

Implementing Google Consent Mode v2 is not just about adding a gtag() command. Developers need to handle consent defaults, visitor updates, tag execution order, preference persistence and third-party scripts.

The implementation also changes depending on the platform.

This guide covers the practical checks for WordPress, Shopify and custom websites.

1. Understand the Four Core Signals

Consent Mode v2 uses four important signals:

{
  ad_storage: "denied",
  analytics_storage: "denied",
  ad_user_data: "denied",
  ad_personalization: "denied"
}
Enter fullscreen mode Exit fullscreen mode

These are illustrative defaults. The correct values depend on the visitor's actual preferences and the website's consent configuration.

Other supported signals include:

  • functionality_storage
  • personalization_storage
  • security_storage

Official documentation: https://developers.google.com/tag-platform/security/guides/consent

2. Start with a Tracking Audit

Before implementation, identify all tracking technologies:

Tool Purpose
GA4 Analytics
Google Ads Advertising
Meta Pixel Advertising
LinkedIn Insight Tag Campaign measurement
TikTok Pixel Advertising
Chat widgets Customer support

Google Consent Mode adjusts supported Google tags. It does not automatically block every third-party script.

3. WordPress Implementation

WordPress has multiple possible integration paths.

Option A: Google Site Kit

If you use Site Kit, review:

  1. Site Kit > Settings > Admin Settings.
  2. Enable Consent Mode where appropriate.
  3. Install and configure the WP Consent API plugin.
  4. Install a compatible CMP.
  5. Map the banner's statistics and marketing categories.
  6. Test the resulting consent states.

The WP Consent API helps plugins communicate consent categories. It does not display a banner or collect consent itself.

Important: Site Kit warns against enabling a second CMP Consent Mode integration when Site Kit is already managing Consent Mode. Duplicate integrations may conflict.

Reference: https://sitekit.withgoogle.com/documentation/features/consent-mode/

Option B: Google Tag Manager

If using GTM:

  1. Install the GTM container.
  2. Configure a CMP template or custom consent template.
  3. Set defaults with Consent Initialization - All Pages.
  4. Map visitor choices to Google consent types.
  5. Update consent after each preference change.
  6. Review additional consent checks for other tags.

For custom templates, use Google's setDefaultConsentState and updateConsentState APIs.

Reference: https://developers.google.com/tag-platform/tag-manager/templates/consent-apis

WordPress verification

  • [ ] No duplicate Consent Mode integrations.
  • [ ] CMP is connected to the correct consent API.
  • [ ] Defaults execute before other tags.
  • [ ] Consent changes update the Google states.
  • [ ] Preferences persist after reload.
  • [ ] Other scripts have separate controls.

4. Shopify Implementation

Shopify has a native Customer Privacy API. Review Shopify Admin > Settings > Customer privacy before installing another consent solution.

The API provides methods for checking whether analytics and marketing processing is allowed:

window.Shopify.customerPrivacy
  .analyticsProcessingAllowed();

window.Shopify.customerPrivacy
  .marketingAllowed();
Enter fullscreen mode Exit fullscreen mode

It also publishes a visitorConsentCollected event when visitor consent changes.

Reference: https://shopify.dev/docs/api/customer-privacy

Third-party CMP integration

Shopify's help documentation says that if you use a third-party cookie banner, it should be integrated with Shopify's customer privacy settings.

A banner that stores preferences separately may not automatically update Shopify-managed surfaces.

Custom pixels

Review custom pixel privacy settings:

  1. Open Shopify Admin.
  2. Go to Settings > Customer events.
  3. Select Custom pixels.
  4. Open the relevant pixel.
  5. Review Permission and Data sale settings.
  6. Save and test.

For custom web pixels, Shopify's documentation explains that Google Consent Mode v2 may require a manual code snippet.

References:

Shopify verification

  • [ ] Customer Privacy settings reviewed.
  • [ ] CMP integrated with Shopify privacy settings.
  • [ ] Custom pixel permissions checked.
  • [ ] Analytics and marketing preferences respected.
  • [ ] Google Consent Mode configured for relevant tags.
  • [ ] Consent changes tested on the storefront.
  • [ ] Checkout-related and pixel behaviour reviewed where applicable.

5. Custom Website Implementation

For a custom site, you can use direct gtag.js integration or GTM.

A simplified direct implementation:

<script>
window.dataLayer = window.dataLayer || [];

function gtag() {
  dataLayer.push(arguments);
}

gtag("consent", "default", {
  ad_storage: "denied",
  analytics_storage: "denied",
  ad_user_data: "denied",
  ad_personalization: "denied"
});
</script>
Enter fullscreen mode Exit fullscreen mode

When the visitor makes a choice, send the corresponding update:

gtag("consent", "update", {
  analytics_storage: "granted",
  ad_storage: "denied",
  ad_user_data: "denied",
  ad_personalization: "denied"
});
Enter fullscreen mode Exit fullscreen mode

This is an example of an analytics-only choice. Your integration must map the actual preferences rather than applying fixed values.

Custom implementation checklist

  • [ ] Define consent defaults before Google tags use consent.
  • [ ] Use region-specific defaults where appropriate.
  • [ ] Connect the banner to the consent update mechanism.
  • [ ] Persist visitor preferences.
  • [ ] Support preference changes and withdrawal.
  • [ ] Test single-page navigation if applicable.
  • [ ] Handle non-Google scripts separately.

6. GTM Execution Order

The Consent Initialization trigger exists to run consent-setting tags before other GTM triggers.

A typical sequence:

Consent Initialization
        |
        v
CMP / Consent Template
        |
        v
Default Consent States
        |
        v
Other Tags and Triggers
        |
        v
Visitor Interaction
        |
        v
Consent Update
Enter fullscreen mode Exit fullscreen mode

For a custom GTM consent template, Google recommends using its consent APIs instead of calling gtag('consent', ...) from a Custom HTML tag.

Reference: https://support.google.com/tagmanager/answer/10718549

7. Test with Tag Assistant

Test the following journeys:

Scenario Check
First visit Defaults are applied
Accept analytics Analytics signal updates
Reject advertising Advertising signals remain denied
Accept all Relevant signals update
Reload Saved preferences are restored
Change settings New values are sent
Withdraw consent Previously granted states are updated
Third-party scripts Separate blocking works

Use Google's Tag Assistant troubleshooting guide:

https://developers.google.com/tag-platform/security/guides/consent-debugging

8. Where a CMP Helps

A CMP can manage the banner, preferences, records and integrations with supported technologies.

ConsentX lists Google Consent Mode v2 support. Review its features and integrations when evaluating the platform. Confirm current installation instructions for the specific WordPress, Shopify or custom setup before deploying.

Final Developer Checklist

  • [ ] Consent collection is implemented.
  • [ ] Consent defaults are timely.
  • [ ] Google consent signals are mapped correctly.
  • [ ] Updates are sent after visitor interaction.
  • [ ] Preferences persist.
  • [ ] Withdrawal is supported.
  • [ ] Non-Google scripts have separate controls.
  • [ ] Tag Assistant confirms expected behaviour.

Top comments (0)