Skip to content

Zaraz Native Consent Bridge

How WP Zbridge passes visitor consent to Cloudflare Zaraz consent purposes and Google Consent Mode v2.

Cloudflare Zaraz can hold each tool until the visitor grants the consent purpose assigned to it. WP Zbridge turns this on whenever something on your site collects consent:

  • the built-in cookie banner is enabled, or
  • Hold Zaraz tools until a consent plugin grants consent is checked (for Complianz, Cookiebot, CookieYes, Borlabs Cookie 3 or the WP Consent API).

Re-export or re-sync your container after changing either setting.


The container defines two purposes and hides the Zaraz consent modal, because your banner or consent plugin collects consent:

Purpose IDNameTools
wpzanAnalyticsGoogle Analytics 4
wpzmkMarketingMeta, Google Ads, TikTok, Snapchat, Pinterest, Bing, LinkedIn

The Instagram embeds tool has no purpose: it shows page content rather than tracking, so it is never held back.


Every consent source calls one helper, window.wpZbridgeConsent.update(analytics, marketing), which:

// Google Consent Mode v2 for GA4 and Google Ads
zaraz.set('google_consent_update', {
ad_storage: 'granted', ad_user_data: 'granted', ad_personalization: 'granted',
analytics_storage: 'granted'
});
// Zaraz consent purposes (after the zarazConsentAPIReady event), one at a time,
// skipping any purpose Zaraz doesn't know (for example Marketing on a GA4-only site)
zaraz.consent.set({ wpzan: true });
zaraz.consent.set({ wpzmk: true });
// Send the pageviews Zaraz held back while waiting for consent
zaraz.consent.sendQueuedEvents();

Default Consent Mode values are sent with zaraz.set('google_consent_default', { ... }) in the page <head>.