The three methods
entailInsights.opt_out_capturing(); // visitor declined
entailInsights.opt_in_capturing(); // visitor accepted
entailInsights.has_opted_out_capturing(); // true or false (once the SDK has loaded)Method | What it does |
|---|---|
| Stops sending events, including the ones you send with trackEvent . Deletes every CROforce cookie and storage entry (they all start with en_) and stops writing new ones. Stops session recording and deletes what was already uploaded. |
| Turns tracking back on. On the same page, the visitor keeps the ID they had, so their visit isn't split in two. |
| Returns |
The choice applies to the whole page, including any second instance you set up with a different name.
1. Find where your banner reports the choice
Every consent tool has a way to tell your code what the visitor chose — a callback, an event or a value you can read. Call the CROforce methods from there. Look for the "analytics" or "statistics" category.
2. Opt out on every page load
The opt-out isn't saved. It lasts until opt_in_capturing() or the next page load. Your consent tool keeps the visitor's choice, so check it and call opt_out_capturing() on every page.
The safest place is right after init in the snippet. The SDK reads a queued opt-out before it starts, so nothing is stored and no page view is sent:
<script>
!function(t,e){ /* …your snippet… */ }(document,window.entailInsights||[]);
entailInsights.init('YOUR_SITE_TOKEN', { disable_decide: false });
// Replace with your consent tool's check.
if (!visitorAcceptedAnalytics()) {
entailInsights.opt_out_capturing();
}
</script>If the choice is only known later, call it as soon as it is. The page view sent before that stays, but nothing after it is sent and the stored IDs are deleted.
3. Opt in when they accept
Generic
// Call from your banner's "accept" handler.
function onConsentAccepted() {
entailInsights.opt_in_capturing();
}
function onConsentDeclined() {
entailInsights.opt_out_capturing();
}Google Consent Mode values
// If your banner exposes the analytics_storage decision:
function applyConsent(consent) {
if (consent.analytics_storage === 'granted') {
entailInsights.opt_in_capturing();
} else {
entailInsights.opt_out_capturing();
}
}Opt-in only (track nobody until they accept)
// Opt every visitor out on load, then opt in when they accept.
entailInsights.init('YOUR_SITE_TOKEN', { disable_decide: false });
if (!visitorAcceptedAnalytics()) {
entailInsights.opt_out_capturing();
}
document.addEventListener('my-consent-accepted', function () {
entailInsights.opt_in_capturing();
});visitorAcceptedAnalytics and my-consent-accepted stand for your consent tool's own check and event.
What keeps working for an opted-out visitor
- Campaigns, widgets, popups, quizzes and A/B tests still show.
- Nothing is stored, so popup frequency rules and test variants can't be remembered between pages.
- No events are sent, so the visitor doesn't appear in your reports, test results or goals.
4. Check it works
- Open your site in a private window and decline tracking in your banner.
- Open DevTools › Application › Cookies: there should be no
en_inscookie, and noen_entries in Local storage. - In the Network tab, filter by
t.entail-insights.comand click around. No new requests should appear. - In the Console, run
entailInsights.has_opted_out_capturing(). It should returntrue.
What CROforce collects
The cookie, what's stored, what session recordings capture and how long they're kept: Data, privacy and session replay.
- Data, privacy and session replay: What is collected and how long it's kept.
- Visitor IDs: The en_ins cookie and how long it lasts.
- Automatically tracked events: What's recorded without code.
Frequently asked questions
Does opting out remember the choice?
No. An opt-out lasts until the visitor opts in or leaves the page. Your consent tool remembers the choice, so call
on every page load for a visitor who declined.opt_out_capturing()
Do popups and A/B tests still work for a visitor who opted out?
Yes. Campaigns, popups and tests keep showing, but nothing is stored in cookies or browser storage and no events are sent. Because nothing is stored, the visitor may see a different test variant on each page.
What happens to a session recording when a visitor opts out?
Recording stops right away, and CROforce asks the server to delete what was already uploaded from that recording.
