Skip to main content

Consent Management (GDPR / KVKK)

<script
src="https://edge.b2metric.com/b2m-web-sdk.js"
data-api-key="YOUR_API_KEY"
data-require-consent="true"></script>

<script>
// When your CMP grants consent:
// window.b2m.giveConsent(); → flushes anything queued
// If consent is declined or withdrawn:
// window.b2m.revokeConsent(); → drops the unsent queue
</script>

With requireConsent enabled, nothing is sent until consent is given — not even on page close. Events are held in a queue; giveConsent() flushes it, revokeConsent() discards whatever hasn't been sent yet.

Cookie/localStorage writes still happen while queuing

Consent gating controls what's sent over the network, not local storage writes — classify the SDK's cookies/localStorage in your CMP accordingly. If cookies can't be treated as strictly necessary on your site, load the SDK only after consent is resolved (in GTM, use the Consent Initialization trigger — see Google Tag Manager).