SDKsJavaScript SDK
Recommended category mappings
JavaScript SDK v1.4.0 — Recommended category mappings
The SDK sends session_id (and session_start: true on the first hit of a session) plus UTM/click-id fields as props, and url/referrer/title as fixed gateway context — map them on the backend's event-type/category configuration so they land as first-class attributes:
| Category | Suggested mapping |
|---|---|
page_view | $context.url → url, $context.referrer → referrer, $context.title → title, $props.session_id → session id, $props.utm_source / $props.utm_medium / $props.utm_campaign → campaign attribution |
add_to_cart | $props.sku, $props.price, $props.quantity as event attributes |
identify (via optima.identify(...)) | posts allowlisted identifiers/attributes directly — no category mapping needed |
page() calls happen automatically on load and (when spa: true, the default) on pushState/replaceState/popstate navigation, so a single mapping covers every page in a single-page app.