This integration applies to demos embedded on your website as an iframe. To control tracking
for demos opened via a direct Navattic link, use the Cookie tracking setting in Demo
Defaults.
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.
Wire the consent banner
After a visitor accepts cookies on your site, send apostMessage to the embedded demo iframe:
Granting consent
Revoking consent
Value payload
Thevalue field accepts either a config object or a string preset.
Config object
String presets
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 theOptanonWrapper callback, which runs on page load and whenever consent changes:
OneTrust
'C0002' with the category ID your organization uses for analytics cookies.
Cookiebot
Use theCookiebotOnAccept event:
Cookiebot
Generic banner
Call this function from your banner’s accept handler:Generic
Related
Demo defaults
Set the workspace-level Cookie tracking default that applies to all demos.
Security and privacy
Overview of Navattic’s security practices and data handling.