Use these interfaces to connect a custom consent tool or another system to OptinFlare. For a standard setup, see Connect a consent tool.
Browser API
On the public site, the OptinFlare script exposes window.optinFlarePrivacy with three purposes: analytics, personalization and captcha.
setConsent(choices): sends the visitorโs choices as booleans. A purpose you omit keeps its current value.permissions(): returns the current decision for each purpose.allows(purpose): returns the decision for one purpose.
You can also dispatch an event:
document.dispatchEvent(new CustomEvent('optinflare:consent', {
detail: { analytics: true, personalization: false, captcha: true }
}));OptinFlare dispatches optinflare:privacy-changed on document when a decision changes, with the new permissions in event.detail, and shares the change with the other open tabs of the site.
Send the choices on every page, whenever they change and when a page is restored from the browser cache. With a GDPR profile, a purpose stays off until it receives true.
The analytics receipt cookie
When analytics is authorized, OptinFlare sets optinflare_privacy_receipt, a first-party HttpOnly and SameSite=Strict cookie, Secure on HTTPS. It holds a random value, never contact details, and lets this browser withdraw the authorization of delayed attribution. It lasts 30 days at most. Without GDPR rules, it is set only once a consent tool has sent a choice.
Consent fields for incoming webhooks (Pro)
With a GDPR profile, an incoming webhook that uses Run form actions (subscription, email and webhook) must add these fields to its JSON body:
privacy_version: the current privacy version of the form.GET /wp-json/optinflare/v1/forms/publishedreturns it for each published form, withconsent_fields, the list of its Consent blocks.consent_choices: one boolean per Consent block, in the order ofconsent_fields.consent_timestamp: the date and time of the visitorโs choice, at most five minutes old.submission_requested:truewhen the form uses Explicit newsletter request or Assessed applicable rules, to confirm a fresh request from the visitor.
{
"email": "[email protected]",
"first_name": "Jane",
"privacy_version": "PRIVACY_VERSION_OF_THE_FORM",
"consent_choices": [true],
"consent_timestamp": "2026-10-29T10:15:00Z"
}Without GDPR rules, these fields are optional. When you send consent_choices, they are still checked, and a false stops the matching actions. The webhook signature proves who sends the request, not the visitorโs consent: keep the original evidence on your side.