Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cevoid.com/llms.txt

Use this file to discover all available pages before exploring further.

Use this guide when you want Cevoid to attach session IDs to browser events. Session tracking is optional and only starts after the SDK’s consent checks pass. For the runtime behavior behind this flow, use How It Works and Consent.

What session tracking does

When session tracking is enabled, the SDK:
  • Resolves consent first
  • Creates or refreshes a cevoid_sid session cookie
  • Attaches the session ID to tracked events when consent is granted
The session uses a 30-minute rolling lifetime.

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}
    />
  )
}

If your storefront spans subdomains, set cookieDomain so the session cookie is written where you need it.
init({
  publishableKey: 'cev_pk_...',
  enableSessionTracking: true,
  cookieDomain: '.example.com'
})
Use a cookie domain when:
  • Your storefront runs on multiple subdomains
  • You want the session cookie shared across those subdomains

The SDK checks these consent sources before attaching a session ID:
  • Shopify Customer Privacy API
  • dataLayer consent entries for analytics_storage
  • window.cevoidTrackingConsent
If the available checks do not grant consent, the SDK still queues and sends events, but without a Cevoid session ID.

4. Verify the session flow

After initialization:
  • Look for the cevoid_sid cookie in the browser
  • Trigger one or more tracked events
  • Confirm your implementation path supplies consent before expecting a session ID
If cookies cannot be written, the SDK falls back to an in-memory session for the current page runtime.
The in-memory fallback does not persist across full page reloads.

Example: Shopify storefront

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

init({
  publishableKey: 'cev_pk_...',
  enableSessionTracking: true,
  cookieDomain: '.example.com'
})
In this setup, the SDK waits for consent resolution before processing deferred events and creating the session.

Common mistakes

  • Expecting a session ID without enabling enableSessionTracking
  • Forgetting cookieDomain when your storefront spans subdomains
  • Assuming missing session IDs mean events were dropped
  • Testing before your consent source is available in the page