Skip to main content
If your site uses a cookie consent banner, you can configure embedded Navattic demos to suppress event tracking and form data persistence until a visitor accepts cookies.

Set a default tracking state

Before wiring your consent banner, set the default tracking state demos use at load time. In Settings → Demo Defaults → Cookie tracking, choose one of three states:
  • Off — No tracking. Event analytics and form data persistence are both suppressed until consent is granted via postMessage.
  • Events — Tracks engagement events but does not persist submitted form data.
  • Events + forms — Full tracking, including form data persistence and pre-fill.
To defer all tracking until consent is granted, set this to Off. You can override this default for a specific demo in Demo Settings → Cookie tracking. After a visitor accepts cookies on your site, send a postMessage to the embedded demo iframe:
Granting consent
To revoke consent:
Revoking consent
The demo updates dynamically — tracking starts or stops on the next event after the message is received.

Value payload

The value field accepts either a config object or a string preset.

Config object

String presets

The 'necessary' preset does not suppress event tracking — events remains true. To suppress analytics, send { events: false, forms: false } instead.
If you use navattic.onEvent to forward events to a tag manager such as Google Tag Manager, callbacks will not fire when events is false.

Examples

OneTrust

Fire the postMessage from the OptanonWrapper callback, which runs on page load and whenever consent changes:
OneTrust
Replace 'C0002' with the category ID your organization uses for analytics cookies.

Cookiebot

Use the CookiebotOnAccept event:
Cookiebot

Generic banner

Call this function from your banner’s accept handler:
Generic