Record only after consent
Hold On-Live recording until the visitor accepts your cookie banner, and stop it when they decline.
Start the SDK in waiting mode, and tell it the visitor's answer from your cookie banner. Flamio then records only the visitors who accept.
The default is to record
consent: 'wait', the SDK records every visitor from page load. If your site must ask first, deploy this change before, or together with, the SDK.Before you begin
- The web SDK is installed, or you are installing it now. See Install the web SDK.
- You need access to your site's code and to your cookie banner or consent platform.
- Your banner keeps the visitor's choice. Flamio does not store it between page loads.
Start the SDK in waiting mode
In the snippet from the Setup page, add consent: 'wait':
import { Flamio } from '@flamioai/web-sdk';
Flamio.init({
projectKey: 'YOUR_KEY_HERE',
endpoint: 'https://api.flamio.org/api',
consent: 'wait',
});YOUR_KEY_HERE is your project key, as in the Setup snippet.
While consent is pending, nothing is recorded, nothing is sent to Flamio, and nothing is stored in the visitor's browser.
Start recording when the visitor accepts
In your banner's accept handler, call:
import { Flamio } from '@flamioai/web-sdk';
Flamio.consent('granted');Recording starts from that moment. What happened on the page before it is not recorded. A Flamio.identify call made before the grant is kept and sent once recording starts.
Stay silent when the visitor declines
In your banner's decline handler, call:
Flamio.consent('denied');If the visitor withdraws consent later, the same call stops recording at once and discards anything not yet sent. A later Flamio.consent('granted') on the same page starts recording again.
Pass the stored choice on every page load
Flamio does not remember the choice. In the Flamio.init call from step 1, pass the choice your consent platform has stored:
import { Flamio } from '@flamioai/web-sdk';
Flamio.init({
projectKey: 'YOUR_KEY_HERE',
endpoint: 'https://api.flamio.org/api',
consent: VISITOR_ACCEPTED ? 'granted' : 'wait',
});VISITOR_ACCEPTED—truewhen your consent platform has a stored acceptance from this visitor. Replace it with your platform's own check.YOUR_KEY_HERE— your project key, as in the Setup snippet.
Deploy and check
Deploy your site. Accept your banner in a fresh browser window and click around. Then reload Flamio On-Live > Setup: step 4 moves to Data is flowing once consenting visitors arrive.
Result
Only visitors who accept are recorded. Visits from people who decline, or never answer, never reach Flamio — so your visit counts in On-Live cover consenting visitors only.
If no data arrives after you deploy, check that your banner really calls Flamio.consent('granted'). See Troubleshooting.
Related
- Consent in the web SDK — the full consent reference
- Mask sensitive content
- Install the web SDK