Mobile SDK Quick Start

Pick the snippet that matches your stack.

React Native

import { TriplePixel } from '@triplewhale/react-native-triple-pixel';

// Once at app startup.
// First arg = the shop-id value in your Triple Whale app URL (e.g. ?shop-id=example.myshopify.com).
TriplePixel.init('example.myshopify.com', 'US', 'USD');

// Screen view
TriplePixel.pageView('/home');

// Product page
TriplePixel.pageViewWithProduct('/products/42', '42', 'T-Shirt', '29.99');

// Add to cart
TriplePixel.addToCart('42', '', 29.99, 1);

// Contact capture
TriplePixel.contact('[email protected]');

// Purchase
TriplePixel.purchase({
  email: '[email protected]',
  lineItems: [{ id: '42', quantity: 1, variant: '', price: 29.99 }],
  orderId: '1001',
  token: 'abc123',
});

Android (Kotlin)

import com.triplewhale.pixel.TriplePixel
import com.triplewhale.pixel.PageLoadEvent

// Once at app startup, e.g. in Application.onCreate.
// First arg = the shop-id value in your Triple Whale app URL (e.g. ?shop-id=example.myshopify.com).
TriplePixel.init(
    shopName = "example.myshopify.com",
    msCountry = "US",
    curr = "USD",
)

TriplePixel.pageLoad(PageLoadEvent(url = "/home"))

iOS (Swift)

import TriplePixelSDK

// Once at app startup, e.g. in AppDelegate / @main App init.
// First arg = the shop-id value in your Triple Whale app URL (e.g. ?shop-id=example.myshopify.com).
TriplePixel.Companion.shared.doInit(
    shopName: "example.myshopify.com",
    msCountry: "US",
    curr: "USD"
)

TriplePixel.Companion.shared.pageLoad(
    e: PageLoadEvent(
        url: "/home",
        productId: nil,
        productName: nil,
        productPrice: nil,
        productVariant: nil,
        searchTerm: nil,
        collection: nil
    )
)

init parameters

ParameterTypeDescription
shopNamestringThe 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).
msCountrystringCountry code for attribution, e.g. "US", "IL".
currstringCurrency code, e.g. "USD", "ILS".

init should be called once at app startup, before any tracking method. Calls made before init short-circuit silently; no events will be sent.

Verify it's working

After calling init and pageView, look for [TriplePixel] log lines in the platform-appropriate console:

  • React Native — Metro console.
  • iOS — Xcode console.
  • Android — Logcat, filtered by the TriplePixel tag (or run adb logcat -s TriplePixel:*).

If you see native module not available instead, see Troubleshooting.