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

SDK API

Reference the public Cevoid Analytics SDK methods for initialization, tracking, identity, and resets.

Use this page when you already know you need the Cevoid Analytics SDK and want the exact public method surface. If you are still deciding between automatic widget behavior, browser-event forwarding, or manual tracking, start with Overview.

Public SDK payload fields use camelCase. The SDK normalizes them to the internal snake_case telemetry format before sending events to the backend.

init(config)

Initializes the SDK. Call it once before your first tracking method. Repeated calls after the first successful initialization are ignored.

OptionTypeDefaultDescription
publishableKeystringNoneRequired workspace publishable key.
enableSessionTrackingbooleanfalseEnables Cevoid-managed session tracking after consent checks pass.
requireConsentbooleanfalseSends no events until tracking consent is granted. Consent that no consent tool has answered counts as denied. Browser events still fire. See Consent.
cookieDomainstringNoneSets the domain for the ca_session cookie.
emitBrowserEventsbooleantrueEmits browser CustomEvent⁠s such as cevoid:post.click.
apiHoststringhttps://telemetry.cevoid.comOverrides the telemetry host.

If enableSessionTracking or requireConsent is true, tracked events are deferred until consent resolution completes, at most 100 of them (the oldest are dropped first).

trackEvent(name, data)

Tracks a supported Cevoid UGC widget event.

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

trackEvent('post.click', {
  widgetId: 'gallery-homepage',
  postId: 'post_123',
  postPosition: 4,
  taggedProductIds: ['prod_1', 'prod_2']
})

Use trackEvent() for custom storefront implementations that need to send supported Cevoid event names manually. The SDK sets widgetType to api on every trackEvent() call, so you do not pass it.

Supported event names:

Unknown event names are ignored.

trackSale(data)

Tracks a completed storefront purchase as sale.complete.

Use this for manual storefront implementations. Standard Shopify sales tracking uses the checkout web pixel path instead of calling trackSale().

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

trackSale({
  orderId: 'order_123',
  marketId: 'market_123',
  customerId: 'cust_456',
  currency: 'USD',
  revenue: 129.99,
  skus: ['SKU-1', 'SKU-2']
})

Required fields:

  • orderId
  • currency
  • revenue

Optional fields:

  • marketId
  • customerId
  • skus

Use trackSale() for completed purchases, not trackEvent() with sale.complete.

identify(data)

Deprecated since 1.2.0. It sends nothing: no event carries external_id. Existing calls keep working, so you can remove them at your own pace. It will be removed in 2.0.0.

reset()

Clears SDK initialization state, deferred events, and in-memory identity data.

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

reset()

Use this on hard storefront context changes such as logout flows when you need to clear the current client-side analytics state.