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 | Your Shopify store identifier. |
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. |
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
}