How it works
There are two parts to the integration:- Admin setting — Turn off cookie tracking by default for your workspace or for individual demos. This ensures embedded demos fire no analytics on load.
- Consent callback — After the visitor accepts your consent banner, send a
postMessageto the Navattic iframe to enable tracking.
Step 1: Disable tracking by default
You can set the default at the workspace level (applies to all demos) or override it per demo. Workspace-wide: Go to Settings > Defaults > toggle on Cookie tracking, then set it to Off. Per-demo: Open the demo in the Product Demos tab > click the three dots > Edit details > toggle Cookie tracking to Off. When tracking is off, the demo fires no analytics events and does not persist form submission data until consent is received.Step 2: Wire your consent banner to the demo
After the visitor accepts your consent banner, send apostMessage to the Navattic iframe:
JavaScript
JavaScript
Value payload reference
Thevalue field accepts an object with two optional boolean flags:
| Field | Type | Description |
|---|---|---|
events | boolean | Controls analytics and engagement tracking |
forms | boolean | Controls persistence and pre-fill of form submission data |
'all', which is equivalent to { events: true, forms: true }.
Provider examples
- OneTrust
Fire the postMessage from the
OptanonWrapper callback, which OneTrust calls whenever consent changes.JavaScript
FAQs
What happens if I don't send the postMessage?
What happens if I don't send the postMessage?
The demo continues with no tracking until a postMessage is received. Analytics events are silently dropped and form data is not persisted.
Does the visitor need to reload the page after accepting?
Does the visitor need to reload the page after accepting?
No. The change takes effect on the next tracked event after the postMessage is received. No reload is needed.
Can I track events but not form data?
Can I track events but not form data?
Yes. Send
{ events: true, forms: false } to enable analytics tracking while keeping form submission data from being persisted or pre-filled.What if my page has multiple Navattic demos?
What if my page has multiple Navattic demos?
Related
Navattic Forms
Learn how form data is collected and persisted in demos.
Demo defaults
Configure workspace-wide defaults for cookie tracking and other settings.