Wendung.setConsent() when the visitor makes or changes their analytics choice. It moves the SDK between the three states described in the consent guide. Calling it with the current state does nothing.
Throws if called before init() or with a value other than the three states.
Parameters
'pending' | 'granted' | 'denied'
required
granted creates the anonymous ID and session, restores a saved identity, and starts collecting from this moment on. With trackPageviews: true, the SDK records the current page. If aggregate collection was active, it sends the queued aggregate batch and starts full collection without recounting that page. The next recorded pageview starts the consented web session. Earlier aggregate pageviews stay unlinked.denied stops the flush timer and navigation tracking, discards queued events without sending them, and removes the anonymous ID, session, and identity from browser storage. Later analytics calls are dropped while the state remains denied.pending discards the current queue and leaves browser storage untouched. With trackPageviews: 'auto', the SDK collects aggregate pageviews without reading or writing identifiers. Otherwise it stops collection. Custom events and identify() calls are dropped while pending.Returns
void
Examples
From a banner
From a settings toggle
The SDK does not persist the state. Store it yourself and pass it back through the
consent option of init() on the next page load.