Skip to main content

Consent mode

Consent mode lets sites control when PureStats sends analytics events.

Default behavior

Without consent mode, the tracker sends pageviews when it loads, subject to site settings such as path exclusions, domain validation and bot filtering.

When consent mode is enabled, the tracker waits until your consent banner or CMP grants analytics permission.

Example:

window.purestats?.consent.grant();

If consent is denied, call window.purestats?.consent.deny(). The consent mode itself can be managed in Site Settings; you do not need to add data-consent-mode to the tracker snippet.

Integrating with a CMP

Connect your consent management platform to PureStats by calling the consent method when the visitor chooses analytics consent. Store consent according to your legal and product requirements.

If a visitor revokes consent during a session, call:

window.purestats?.consent.revoke();

After this, your application should stop sending analytics events.

Verification

When consent mode is active, Site Health may show script found and script loads before first hit received. That is expected until consent is granted.