RTN Docs

Android SDK · Preview

Events and identity

Track custom events, screens and the ecommerce journey, and connect app activity to known customers on Android.

Preview: planned API

The Android SDK is in development and not published yet. This page describes the API we are building so you can plan your integration. Package names, signatures and defaults may still change before the first release.

Custom events and screens

Event names are lowercase snake_case, the same rule as the Web SDK. Properties accept strings, numbers, booleans, null and nested lists or maps.

RTN.track("filter_applied", mapOf(
    "filter" to "color",
    "value" to "black",
))

RTN.screen("Product detail", mapOf("product_id" to "sku_123"))

Automatic screens

With trackScreens = true, every resumed Activity sends screen_viewed with its class name. For Jetpack Compose or fragments, call RTN.screen(...) from your navigation listener instead.

Properties on every event

Registered properties are added to every following event until you remove them. Event properties win when both set the same key.

RTN.register(mapOf("app_theme" to "dark"))
RTN.unregister("app_theme")

Ecommerce journey

The ecommerce helpers send the same events as the Web SDK (product_viewed, product_added_to_cart, cart_viewed, checkout_started, order_completed and more), so web and app journeys appear side by side in reports and segments. The product fields and their rules are the same as in Ecommerce Events.

val product = RTNProduct(
    productId = "sku_123",
    variantId = "sku_123_black",
    name = "Everyday Backpack",
    brand = "Northwind",
    category = "Bags",
    price = 89.90,
    currency = "USD",
)

RTN.productViewed(product)
RTN.productAddedToCart(product.copy(quantity = 2), cartId = "cart_456")
RTN.checkoutStarted(cart)
RTN.orderCompleted(order)

Identify customers

Call identify after sign-in or sign-up. Earlier anonymous events on this device are linked to the customer, and their web activity is merged when the same customer ID or email is used on your site.

// After sign-in or sign-up
RTN.identify("user_123", mapOf(
    "email" to "ada@example.com",
    "first_name" to "Ada",
))

// Guest checkout: traits only
RTN.identify(mapOf("email" to "guest@example.com"))

// At sign-out
RTN.reset()

On this page