Skip to content
Get API key (opens in a new tab)

Session tracking

Enable Cevoid session tracking and verify when the SDK keeps the same session ID on analytics events across page loads.

Use this page when you want Cevoid to keep the same session ID on tracked events across page loads. If you only need the exact consent and cookie rules, use Consent instead.

Session tracking is optional. Without it, the SDK still sends events, but their session_id lasts only for the current page runtime and no ca_session cookie is written.

Why this matters

Session tracking is what allows Cevoid to connect supported gallery activity and completed orders.

That means:

  • when you enable session tracking together with sales tracking, Cevoid can measure attribution between Cevoid widget interactions and a completed order when consent resolves to granted
  • when you enable session tracking without sales tracking, Cevoid can still measure gallery and card behavior, but there is no completed order to connect those interactions to
  • when you enable sales tracking without session tracking, the sale can still be recorded, but Cevoid usually cannot connect a Cevoid widget event to that order

In practice, session tracking is usually most valuable when it is enabled together with sales tracking.

What session tracking adds

When session tracking is enabled and consent resolves to granted, the SDK:

  • creates or refreshes ca_session
  • uses a 30-minute rolling session lifetime
  • keeps the same session_id on tracked events across page loads

If consent is denied:

  • events can still be sent
  • ca_session is not written, so session_id lasts only for the current page runtime

1. Turn on session tracking

Enable it in init() or in the React component props.

import { init } from '@cevoid/analytics-sdk'

init({
  publishableKey: 'cev_pk_...',
  enableSessionTracking: true
})

React example:

import { Analytics as CevoidAnalytics } from '@cevoid/analytics-sdk/react'

export function App() {
  return <CevoidAnalytics publishableKey="cev_pk_..." enableSessionTracking={true} />
}

2. Configure cookieDomain when needed

If your storefront spans subdomains, set cookieDomain so ca_session is written where you need it.

init({
  publishableKey: 'cev_pk_...',
  enableSessionTracking: true,
  cookieDomain: '.example.com'
})

Use cookieDomain when:

  • your storefront runs on multiple subdomains
  • you want the session cookie shared across those subdomains

3. Add the cookie-policy entry when needed

If your storefront requires cookie disclosures before enabling analytics storage, add ca_session to your cookie policy before enabling session tracking in production.

Suggested description:

Collects statistics from the visitor's interaction with Cevoid galleries on the website, such as post views, gallery views, post clicks, product clicks and statistics about order value after checkout.

When session tracking is enabled, the SDK checks these consent sources when they are present:

  • Shopify Customer Privacy API
  • dataLayer consent entries for analytics_storage
  • window.cevoidTrackingConsent

On a non-Shopify site with no dataLayer consent entry and no window.cevoidTrackingConsent value, consent defaults to granted and the SDK can create ca_session.

If any present consent source resolves to denied, the SDK still sends events but does not write ca_session.

5. Verify the session flow

After initialization:

  • look for ca_session in the browser
  • trigger one or more tracked events
  • if you use Shopify, GTM consent, or window.cevoidTrackingConsent, confirm that your consent source is available before expecting ca_session

If consent is granted but cookies cannot be written, the SDK falls back to an in-memory session for the current page runtime only.

Common mistakes

  • expecting ca_session without enabling enableSessionTracking
  • forgetting cookieDomain when the storefront spans subdomains
  • assuming a missing ca_session cookie means the event was dropped
  • on Shopify, testing before the relevant consent source is available