登录
登录
ANA像素追踪归因分析数据分析广告管理
Z1
AI 建站
全部产品
案例服务价格关于帮助
联系我们

像素

/

2 min read

Configure consent (GDPR/CCPA)

Gate the Zalify Pixel on visitor consent — automatically on Shopify, or with a one-line API call on any site.

The Zalify Pixel can hold tracking until a visitor grants consent, so you stay compliant with GDPR and CCPA. Pick the option that matches how your site collects consent today.

Option 1 — Shopify (zero config)

If your store exposes Shopify's customer-privacy API (window.Shopify.customerPrivacy.analyticsProcessingAllowed), the Pixel wires into it automatically: it reads consent at boot, subscribes to Shopify's visitorConsentCollected events, and ignores manual consent parameters.

Nothing to do on Shopify

As long as your Shopify privacy/consent settings are on, consent just works. The manual options below are for non-Shopify sites or custom banners.

Option 2 — Tell the Pixel from your banner

If you have your own consent banner, call the Pixel's API when the visitor accepts:

window.zalify('consent', { analytics: 'granted' });

This unblocks the Pixel's boot synchronously and persists the choice to localStorage, so the visitor doesn't have to re-consent on their next visit.

Option 3 — Point the Pixel at an existing storage key

If a consent tool already writes the visitor's choice to localStorage, tell the Pixel which key to read by adding two parameters to the script URL:

<script src="https://cdn.zalify.com/pixel.js?wid=YOUR_WORKSPACE_ID&consentRequired=true&consentStorageKey=consent_state" defer></script>

With consentRequired=true, the Pixel:

  • checks that localStorage key at boot,
  • listens for cross-tab storage events so consent granted in another tab takes effect, and
  • polls roughly every 500 ms for up to 5 minutes, waiting for the choice to appear.

You can also let visitors opt in from inside a Zalify popup using a grant_consent button, so a popup can double as your consent prompt. See Create your first popup.

Preview Mode bypasses the gate

Visitors in Preview Mode (?zalify-preview=true) skip the consent gate, which is convenient for internal testing but means Preview isn't the place to verify the gate itself. To confirm gating works, test in a normal session and watch whether events start only after you grant consent. See Test your setup with Preview Mode.

Next steps

上一篇

Test your setup with Preview Mode

下一篇

Send conversions to Meta, Google, TikTok & more