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

@nordcom/commerce-cart
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 });
};

RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter

On this page