AnalyticsEmit
●cart · /core·type
Callback injected into the middleware to forward mutation outcome events to the host's analytics pipeline. Receives an event name and a structured attribute bag rather than raw cart objects.
Definition
type AnalyticsEmit = (event: string, attrs: Record<string, unknown>) => void;(event: string, attrs: Record<string, unknown>) => void
Example
const emit: AnalyticsEmit = (event, attrs) => {
window.dataLayer?.push({ event, ...attrs });
};Related
RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter
MetadataOpen in GitHub ↗
AdapterCtx
Immutable context threaded into every adapter call by the kernel. Carries shop identity, locale, logger, and optional perrequest signals so adapters never reach
analytics
Builtin middleware that calls the hostsupplied emit on every mutation: cart.mutation.success on resolve and cart.mutation.error on reject. The emit call is fire