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 = your Triple Whale shop ID (NOT your storefront domain / shop name).
TriplePixel.init('your-tw-shop-id', '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 = your Triple Whale shop ID (NOT your storefront domain / shop name).
TriplePixel.init(
    shopName = "your-tw-shop-id",
    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 = your Triple Whale shop ID (NOT your storefront domain / shop name).
TriplePixel.Companion.shared.doInit(
    shopName: "your-tw-shop-id",
    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
shopNamestringYour Triple Whale shop ID — the identifier registered for your store in Triple Whale (e.g. myshop.myshopify.com). Do not pass your storefront domain or shop name.
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.