import type { AnyCommerceEvent, CommerceItem } from '@evershop/evershop/types/commerceEvents'; /** * Commerce events (`components/common/commerceEvents.ts`) as GA4's * recommended ecommerce events, for `gtag('event', name, params)`. * `GoogleAnalytics.tsx` sends them when the store has a Measurement ID. * * Only events GA4 has a name for. `checkout_contact_info_submitted` and the * coupon events have none, so they are not sent. */ export interface Ga4Event { name: string; params: Record; } export interface Ga4Item { item_id: string; item_name: string; item_variant?: string; /** * The unit price after the discount. The discount is rounded per unit, so * Σ price × quantity can differ from the event's value by up to half a * cent (the currency's smallest unit) per unit */ price: number; /** The discount per unit */ discount?: number; /** The coupon that gave the discount (GA4's "Item coupon") */ coupon?: string; quantity: number; [category: `item_category${string}`]: string; } /** * `coupon`: the cart's or order's coupon. Only an item with a discount gets * it: a coupon for some products discounts only those, and in core an item's * discount comes only from the coupon. */ export declare function toGa4Item(item: CommerceItem, currency: string, coupon?: string): Ga4Item; /** The GA4 event for a commerce event, or null when GA4 has none */ export declare function toGa4Event(event: AnyCommerceEvent): Ga4Event | null;