cookiepal.oss
Banner

Integrations

Forward consent state to third-party services like Google Tag Manager, Shopify, and WordPress.

Integrations are opt-in bridges that translate a visitor's consent state into the format a third-party service expects. They ship inside the consent bundle — no extra install step — and are enabled either from the Integrations tab of the dashboard or directly in your CookiepalConfig.

Available integrations

Syncs consent to Google's Consent Mode v2 by pushing gtag('consent', ...) commands to the dataLayer. Denies everything except security_storage by default, then updates when the visitor chooses.

Mapping:

Cookiepal categoryGoogle signal
advertisementad_storage, ad_user_data, ad_personalization
analyticsanalytics_storage
necessaryfunctionality_storage
performancepersonalization_storage
(always)security_storage: 'granted'

Shopify (shopify)

Forwards consent to Shopify's Customer Privacy API via Shopify.customerPrivacy.setTrackingConsent. Loads the consent-tracking-api feature on page load, then syncs on every consent change.

Mapping:

Cookiepal categoryShopify signal
analyticsanalytics
advertisementmarketing
functionalpreferences

WordPress (wordpress)

Forwards consent to the WP Consent API plugin by calling window.wp_set_consent(category, 'allow' | 'deny') for each WP category. Syncs once on install, then on every cookiepal_consent_update and cookiepal_banner_load event. If the WP Consent API plugin isn't installed, the integration silently no-ops (turn on debug to see a warning instead).

Mapping:

WP categorySourceNotes
functionalalways allowmatches WP Consent API's "strictly necessary" semantics
preferencescookiepal functional
statisticscookiepal analytics
statistics-anonymouscookiepal analyticssame source, separate category required by WP
marketingcookiepal advertisement

Enable from the dashboard

Run cookiepal dashboard, open the Integrations tab, and toggle the integration you want. Re-run cookiepal build to bake the updated config into bundle.js.

Enable programmatically

If you're calling the runtime yourself (see Programmatic API), pass an integrations object on CookiepalConfig:

import { createConsentManager } from '@cookiepal-oss/consent';

createConsentManager({
  categories: [/* ... */],
  integrations: {
    gcm: { enabled: true },
    shopify: { enabled: true },
    wordpress: { enabled: true },
  },
});

Each integration key maps to its options type — GcmOptions, ShopifyOptions, and WordpressOptions are exported from @cookiepal-oss/integrations if you need to type them explicitly.

On this page