Integrate the Osano CMP JavaScript API to read consent status and gate analytics event firing

domain: developers.osano.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Add the Osano CMP script to your page <head>: <script src='https://cmp.osano.com/YOUR_CONFIG_ID/osano.js'></script>; Osano loads synchronously and exposes the window.Osano object immediately.
  2. Listen for the consent decision event: window.Osano.cm.addEventListener('osano-cm-consent-saved', (consent) => { handleConsent(consent); }); the consent object contains a map of category names to ACCEPT, DENY, or INCOMPLETE.
  3. Check current consent for a specific category synchronously via window.Osano.cm.getConsent().ANALYTICS (or MARKETING, PERSONALIZATION, etc.) before firing any tracking code.
  4. Gate analytics calls: if (window.Osano.cm.getConsent().ANALYTICS === 'ACCEPT') { analytics.track(event); } else { queueForLater(event); } and replay the queue after the consent-saved event fires with ACCEPT.
  5. For server-side consent reads, use the Osano Unified Consent REST API: GET https://api.osano.com/uc/v1/consents/{customerId} with your Osano API key in the X-Osano-Api-Key header to retrieve stored consent for a returning user.
  6. Map Osano's category enum values to your internal consent flags and document the mapping in your consent management runbook.

Known gotchas

Related routes

Implement a Didomi consent event to record and retrieve user consent proofs via the Didomi REST API
developers.didomi.io · 6 steps · unrated
Implement a cross-device consent synchronization flow using a consent server-side API and signed JWT tokens
docs.transcend.io · 6 steps · unrated
Implement consent-based tag firing in Usercentrics with the Browser SDK event API for a single-page application
docs.usercentrics.com · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans