Skip to main content

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​

FieldTypeRequiredDescription
idStringYesYour order ID
subtotalDoubleYesOrder subtotal before tax and shipping
currencyStringYesThree-letter currency code (e.g. "USD")
totalDoubleYesTotal order value including tax and shipping
taxDoubleNoTax amount
shippingCostDoubleNoShipping cost
shippingMethodStringNoShipping method name
couponStringNoCoupon code applied

Product Fields​

FieldTypeRequiredDescription
idStringYesProduct SKU or identifier
nameStringYesProduct display name
priceDoubleYesUnit price
currencyStringYesThree-letter currency code
quantityIntYesQuantity purchased
imageStringNoProduct image URL
brandStringNoBrand name
categoryStringNoCategory path (e.g. "Footwear > Sports > Tennis")
locationStringNoProduct page URL

Notes​

  • Call track() after the purchase completes in your backend — not when the user taps checkout.
  • track() is on the BambuserSDK instance, not on viewAction. It does not require an active player session.
  • The tracking window is 30 days from the viewer's last engagement with a live show.