trackPageviews: 'auto' to collect aggregate pageviews while the choice is pending. Aggregate pageviews contain no visitor or session identifiers.
Your consent manager supplies the visitor’s choice. The SDK shows no banner and does not store that choice.
This page describes what the SDK does in each state. Whether your deployment needs consent, and which exemptions apply, is a question for your own legal review.
The three states
Consent defaults to
granted. Pass the current choice on every page load, using pending when the visitor has not chosen. Automatic pageviews are off by default. Set trackPageviews: true to wait for consent, or 'auto' to collect aggregate pageviews while pending.
Setup
1
Start pending, or restore the saved choice
Read the visitor’s earlier choice from wherever you keep it and pass it to This enables aggregate pageviews while pending and full analytics after consent. Use
init(). With no saved choice, start pending.trackPageviews: true if you want no collection before consent.With the script tag, use data-track-pageviews="auto" and data-consent="pending".2
Apply the choice
Call
setConsent() from your banner or consent manager. Granting consent starts full analytics for subsequent activity. If aggregate collection was active, the SDK sends the pending aggregate batch without recounting the current page. The next recorded pageview starts the consented web session. With trackPageviews: true, granting consent records the current page.If the visitor is already signed in, call identify() again. Calls made while pending were dropped, and earlier aggregate pageviews stay unlinked.3
Offer withdrawal
Keep a control in your settings that calls
setConsent('denied'). It stops collection, discards anything still queued, and removes the SDK’s identifiers from the browser. Events that were already delivered stay in your project; use the data deletion controls in the dashboard for those.getConsent() returns the current state, which is what a settings toggle reads.What aggregate pageviews can measure
Aggregate pageviews contribute to pageview totals and pageview breakdowns. They do not count as unique visitors, current visitors, or sessions. Bounce rate, session duration, views per session, and entry and exit pages describe consented traffic only. The SDK omits query parameters, fragments, titles, screen dimensions, and visitor identifiers from aggregate pageviews. Pathnames can still contain personal information. See pageview fields and limitations. This option does not establish a consent exemption for your deployment.With a consent manager
Connect the manager’s callbacks tosetConsent() and let the manager remain the source of truth. The example uses CookieConsent with an analytics category; other managers expose equivalent hooks.
onConsent also applies the saved choice on later visits. This example leaves automatic pageviews off. Add trackPageviews: 'auto' to init() if you also want aggregate pageviews while pending and full pageviews after consent.
In React
A small hook keeps the SDK, your storage, and the UI in one place.consent === 'pending' and a switch in settings bound to consent === 'granted'. The Wendung dashboard itself works this way: it asks once after sign-in and keeps the switch under Account.
What the SDK does not do
- It does not store the choice. Pass it to
init()on every page load. - It does not replay activity from before consent, and it does not record which notice the visitor saw. Keep that record in your consent manager if you need to demonstrate consent.
- It does not retract batches that were already delivered.
- It does not collect aggregate pageviews after denial.
deniedstops all analytics, including withtrackPageviews: 'auto'.