What is expected behavior for "Domain Session ID"

When is “Domain Session ID” expected to remain constant and when is it expected to change?

We’re seeing this value change whenever a link opens in a new tab (to our same company.com domain, but different subdomain), but it doesn’t change if we are on the main site and then manually type in the target of the link.

Basically, new tab = new session. Is this expected?

We have “discoverRootDomain: true” set in initialization.

Thank you,

Sam

@samueln, no, this is not expected. The “Domain Session ID” corresponds to the value set on the 1st party cookie, _sp (unless renamed in the tracker initialization code). I would imagine that somehow the cookie is blocked which results in resetting its value on each pageview. It could be done by adblockers, for example.

Here’s how it’s expected to work. Javascript tracker generates the session ID and increments when a user was not active for 30 minutes (by default). The duration could be adjusted as explained here.

Actually, the Javascript tracker sets two first party cookies as described here. The default names of the cookies are:

  • _sp_id - a domain cookie
  • _sp_ses - a session cookie

It is possible to set sp to a different value when initializing the Javascript tracker. If you set it to e.g. mycompany then the cookie names would be _mycompany_id and _mycompany_ses accordingly.

The value of _sp_id is recorded in the domain_userid field in the atomic.events table. The values of domain_sessionidx and domain_sessionid are based on the values in the _sp_ses cookie.

Do you happen to use localStorage as your storage strategy? You might want to ensure you are using the latest version of the tracker, 2.12.0+ as the previous versions have a bug that affects how the sessions are handled:

2 Likes

Thank you. I’ll investigate the cookies more.

we are using localStorage and did recently upgrade to 2.12.0 tracker. The issue persists after this upgrade (upgraded in non-prod months ago, in prod recently).

Multiple people can repro across multiple browsers and OS. Your response gives me more things to look into though.

Sam