The React Native API is the canonical surface shown here. Native Android and iOS expose the same events with platform-typed payloads.
All tracking methods are fire-and-forget: they do not return promises and do not throw. A malformed payload or a missing native module produces a console warning, never an exception. getConsentStatus() is the only async method.
Lifecycle
init(shopName, msCountry, curr)
init(shopName, msCountry, curr)Required once at app startup.
| Parameter | Type | Description |
|---|---|---|
shopName | string | The unique identifier for the shop (e.g. example.myshopify.com). This is the shop-id value in your Triple Whale app URL (for example ?shop-id=example.myshopify.com). |
msCountry | string | Country code for attribution. |
curr | string | Currency code. |
Tracking
pageView(url)
pageView(url)Screen view.
| Parameter | Type | Description |
|---|---|---|
url | string | The screen path or URL. |
pageViewWithProduct(url, productId, productName, productPrice)
pageViewWithProduct(url, productId, productName, productPrice)Screen view with product context.
| Parameter | Type | Description |
|---|---|---|
url | string | The screen path or URL. |
productId | string | The product identifier. |
productName | string | The product name. |
productPrice | string | The product price, e.g. "29.99". |
addToCart(productId, variant, price, quantity)
addToCart(productId, variant, price, quantity)Item added to cart.
| Parameter | Type | Description |
|---|---|---|
productId | string | The product identifier. |
variant | string | The variant identifier. Pass an empty string if no variant. |
price | number | Per-unit price. |
quantity | number | Number of units added. |
contact(email, phone?)
contact(email, phone?)Capture user contact info.
| Parameter | Type | Description |
|---|---|---|
email | string | The user's email address. |
phone | string (optional) | The user's phone number. |
custom(name, properties?)
custom(name, properties?)Your own named event.
| Parameter | Type | Description |
|---|---|---|
name | string | The event name. event_name is reserved. |
properties | object (optional) | Up to 10 properties. Keys max 40 characters; values are stringified and capped at 100 characters. |
Breaching any limit drops the whole event rather than sending a partial one. Call pageView at least once first; custom events carry the current page-view session ID.
Identity
identify(userId, userData?)
identify(userId, userData?)Associate the session with your own user ID.
| Parameter | Type | Description |
|---|---|---|
userId | string | Your identifier for the user. |
userData | object (optional) | { email?, phone?, firstName?, lastName? }. Each field max 255 characters. |
Call it after login or signup; once per session is enough. Call pageView at least once first — identify events carry the current page-view session ID, and without one the event can't be tied to the session. The ID is persisted (Android SharedPreferences, iOS NSUserDefaults) and attached to later identify, page-view, and custom events. An over-long field drops the whole call rather than sending a truncated value.
reset()
reset()Forget the ID set by identify, e.g. on logout.
Sends no event. Later events fall back to the anonymous ID; the anonymous ID and consent state are left untouched.
Checkout funnel
All checkout methods accept the same CheckoutOptions object:
type CheckoutOptions = {
email: string; // required (or phone)
phone?: string;
firstName?: string;
lastName?: string;
orderId?: string; // required for purchase()
token?: string;
checkoutUrl?: string;
lineItems: LineItem[]; // required, non-empty
discountTotal?: number;
discountCodes?: string[];
};
type LineItem = {
id: string;
quantity: number;
variant?: string;
price?: number; // per-unit
};| Method | Funnel step |
|---|---|
checkoutStarted(options) | User entered checkout. |
paymentSubmitted(options) | Payment info submitted. |
purchase(options) | Order confirmed. Requires orderId. |
addressSubmitted(options) | Shipping address submitted. |
contactSubmitted(options) | Contact info submitted. |
shippingSubmitted(options) | Shipping method submitted. |
const order = {
email: '[email protected]',
firstName: 'Sam',
lastName: 'Brown',
lineItems: [
{ id: '42', quantity: 2, variant: 'red-M', price: 29.99 },
{ id: '99', quantity: 1, price: 9.99 },
],
orderId: '1001',
token: 'abc123',
discountTotal: 5.00,
discountCodes: ['SUMMER5'],
};
TriplePixel.checkoutStarted(order);
TriplePixel.contactSubmitted(order);
TriplePixel.addressSubmitted(order);
TriplePixel.shippingSubmitted(order);
TriplePixel.paymentSubmitted(order);
TriplePixel.purchase(order);Consent
setConsentGranted()
setConsentGranted()Mark consent as granted. Tracking proceeds normally.
setConsentDenied()
setConsentDenied()Mark consent as denied. Clears the persisted user ID and session state, cancels in-flight sends, and blocks every subsequent track call. Persists across app restarts.
getConsentStatus()
getConsentStatus()Returns Promise<'UNKNOWN' | 'GRANTED' | 'DENIED' | undefined>. Resolves to undefined if the native module is unreachable. Never rejects.
const status = await TriplePixel.getConsentStatus();
if (status === 'UNKNOWN') {
// Show your consent banner
}