Skip to main content

Basket Events

Track shopping cart interactions to understand purchase intent.

Basket Viewed

Track when a user views a dedicated page, screen, or modal with the contents of their shopping basket:

Ometria.trackBasketViewedEvent();

Basket Updated

Track when the shopping cart contents change:

const items: OmetriaBasketItem[] = [
{
productId: 'product-1',
sku: 'sku-product-1',
quantity: 1,
price: 12.0,
variantId: 'variant-1',
},
{
productId: 'product-2',
sku: 'sku-product-2',
quantity: 2,
price: 9.0,
variantId: 'variant-2',
},
];

Ometria.trackBasketUpdatedEvent({
totalPrice: 30.0,
id: 'basket_123',
currency: 'USD',
items,
link: 'https://yourstore.com/basket/123',
});
info

Always send the full current basket - not just the updated parts. This helps recover from lost or out-of-sync events; the latest update is always authoritative.

Data Types

OmetriaBasket

PropertyTypeRequiredDescription
idstringNoUnique identifier for this basket
currencystringYesISO 4217 currency code (e.g., "USD", "GBP")
totalPricenumberYesTotal basket price
itemsOmetriaBasketItem[]YesArray of basket items
linkstringNoA deeplink to the web or in-app page for this basket. Can be used in a notification sent to the user, e.g. "Forgot to check out? Here's your basket to continue: <link>". Following that link should take them straight to the basket page.

OmetriaBasketItem

PropertyTypeRequiredDescription
productIdstringYesUnique product identifier
skustringNoStock keeping unit
quantitynumberYesNumber of items
pricenumberYesPrice per item (currency from parent basket)
variantIdstringNoVariant product identifier

Example: Complete Basket Flow

import Ometria, { OmetriaBasketItem } from 'react-native-ometria';

// User adds first item
const items: OmetriaBasketItem[] = [
{ productId: 'shoe-001', quantity: 1, price: 89.99 },
];

Ometria.trackBasketUpdatedEvent({
totalPrice: 89.99,
currency: 'GBP',
items,
});

// User adds another item
items.push({ productId: 'sock-002', quantity: 2, price: 12.99 });

Ometria.trackBasketUpdatedEvent({
totalPrice: 115.97,
currency: 'GBP',
items,
});

// User views basket
Ometria.trackBasketViewedEvent();