Visitor IDs

CROforce gives every browser a random visitor ID and keeps it for a year, so it can count returning visitors and show each one the same test variant. Read it with get_distinct_id().

On this pageThe two IDsRead the visitor IDAcross subdomainsWhen a visitor gets a new ID

Updated November 28, 2026

Not set
Find it on the install page of your account. It stays in this browser and is never sent anywhere.

The two IDs

ID

How long it lasts

What it's for

Visitor (device) ID

365 days

Recognizes a returning visitor and keeps them in the same
test variant
on every visit.

Session ID

Up to 12 hours from the session's start

Groups one visit's pages and events, as shown in
Visitor activity
and
Session replay
.

Both are stored in a first-party cookie named en_ins and in your site's local storage. When the two disagree, the cookie wins. You can change where they're stored with the persistence option in init options.

Read the visitor ID

get_distinct_id() returns the visitor ID. It exists only once the SDK has loaded, so call it from the loaded callback:

JavaScript
entailInsights.init('YOUR_SITE_TOKEN', {
  disable_decide: false,
  loaded: function (sdk) {
    var visitorId = sdk.get_distinct_id();
    // e.g. store it with your own lead or order
    document.querySelector('#entail-visitor-id').value = visitorId;
  },
});
Paste your site token at the top of the page to fill it in.

Later on the same page, once loaded, window.entailInsights.get_distinct_id() works too.

Use it to connect CROforce to your own data — save it with a lead in your CRM, or with an order in your database — then look the visitor up in Visitor activity.

HubSpot forms fill it in for you

Add hidden fields with these internal names to a HubSpot form, and CROforce fills them when the page loads:

Hidden field name

Filled with

entail_device_id or entail_distinct_id

The visitor ID

entail_session_id

The session ID

Across subdomains

The en_ins cookie is set on your root domain (.example.com), so www.example.com, shop.example.com and try.example.com all see one visitor and one session. That matters for redirect tests that send visitors to another subdomain: the conversion on the destination is credited to the same visitor.

  • Another domain (from example.com to example-shop.com) can't read the cookie, so the visitor gets new IDs there.
  • On *.herokuapp.com the cookie stays on the exact subdomain, because browsers don't allow cookies on shared hosting domains.
  • To keep the cookie on the exact subdomain everywhere, pass cross_subdomain_cookie: false.

When a visitor gets a new ID

  • They clear their cookies and site data, or browse in a private window.
  • They switch to another browser or device.
  • The cookie is older than 365 days (change it with cookie_expiration).
  • They opted out on an earlier page: opting out deletes the stored IDs — see Consent and privacy.

Don't call reset(). The snippet's placeholder lists a reset method, but the SDK doesn't support it: a call made before the SDK loads drops the events queued after it and leaves entailInsights unusable on that page, and one made after throws an error.

Frequently asked questions

Does the visitor ID contain personal data?

No. It's a random ID created in the browser. It doesn't contain a name, email or IP address.

Will a visitor keep their ID across my subdomains?

Yes. The cookie is set on your root domain, so www.example.com and shop.example.com share the same visitor and session. A different domain can't read the cookie, so it starts a new visitor.

Why does get_distinct_id say it's not a function?

The snippet's placeholder doesn't include it. Call it after the SDK has loaded, for example from the

loaded
callback in
init
.

Was this article helpful?

Try it on your own site

Add a popup, form or quiz to your site in a few minutes and see what it does for your conversions.