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
Google Consent Mode (gcm)
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 category | Google signal |
|---|---|
advertisement | ad_storage, ad_user_data, ad_personalization |
analytics | analytics_storage |
necessary | functionality_storage |
performance | personalization_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 category | Shopify signal |
|---|---|
analytics | analytics |
advertisement | marketing |
functional | preferences |
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 category | Source | Notes |
|---|---|---|
functional | always allow | matches WP Consent API's "strictly necessary" semantics |
preferences | cookiepal functional | |
statistics | cookiepal analytics | |
statistics-anonymous | cookiepal analytics | same source, separate category required by WP |
marketing | cookiepal 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.