Tracking
Bambuser Conversion Tracking attributes purchases and other conversions to the live shows that influenced them. Call track() on your BambuserSDK instance after a transaction completes in your app.
Purchase Tracking
track() is a suspend function — it must be called from a coroutine scope:
lifecycleScope.launch {
globalBambuserSDK.track(
eventName = "purchase",
data = mapOf(
"purchase" to mapOf(
"id" to "ORDER-123",
"subtotal" to 70.99,
"currency" to "USD",
"total" to 74.98,
"tax" to 4.0,
"shippingCost" to 3.99,
"shippingMethod" to "Standard",
"coupon" to "SUMMER_SALE",
),
"products" to listOf(
mapOf(
"id" to "sku-123",
"name" to "Tennis Shoe Classic - Size 10",
"image" to "https://example.com/images/shoe.jpg",
"price" to 70.99,
"currency" to "USD",
"quantity" to 1,
"brand" to "Plausible Co.",
"category" to "Footwear > Sports > Tennis",
"location" to "https://example.com/products/shoe",
)
)
)
)
}
track() returns Result<Boolean>. You can inspect it to check for errors:
val result = globalBambuserSDK.track(eventName = "purchase", data = purchaseData)
result.onFailure { error ->
Log.e("Bambuser", "Tracking failed: ${error.message}")
}
Purchase Transaction Fields
| Field | Type | Required | Description |
|---|---|---|---|
id | String | Yes | Your order ID |
subtotal | Double | Yes | Order subtotal before tax and shipping |
currency | String | Yes | Three-letter currency code (e.g. "USD") |
total | Double | Yes | Total order value including tax and shipping |
tax | Double | No | Tax amount |
shippingCost | Double | No | Shipping cost |
shippingMethod | String | No | Shipping method name |
coupon | String | No | Coupon code applied |
Product Fields
| Field | Type | Required | Description |
|---|---|---|---|
id | String | Yes | Product SKU or identifier |
name | String | Yes | Product display name |
price | Double | Yes | Unit price |
currency | String | Yes | Three-letter currency code |
quantity | Int | Yes | Quantity purchased |
image | String | No | Product image URL |
brand | String | No | Brand name |
category | String | No | Category path (e.g. "Footwear > Sports > Tennis") |
location | String | No | Product page URL |
Notes
- Call
track()after the purchase completes in your backend — not when the user taps checkout. track()is on theBambuserSDKinstance, not onviewAction. It does not require an active player session.- The tracking window is 30 days from the viewer's last engagement with a live show.
Was this page helpful?