Interactions
Generates: Spans
Tracks user journeys across your app. An interaction is a server-defined sequence of events (e.g. cart → payment → confirmation) that, when completed, is emitted as a single OTel span with all constituent steps captured as span events.
Interactions are defined and controlled entirely from the Pulse dashboard — no code changes are needed to define new flows.
How It Works
The SDK continuously listens to trackEvent() calls. When a sequence of events matches a server-configured interaction definition, it creates a span covering the full duration of that flow.
Configuration
Enabled by default via interaction { } in initialize(). The SDK fetches interaction flow definitions from the Pulse backend at startup — the URL is automatically derived from your endpointBaseUrl.
PulseSDK.INSTANCE.initialize(
application = this,
endpointBaseUrl = "https://your-backend.com",
apiKey = "your-api-key",
dataCollectionState = PulseDataCollectionConsent.ALLOWED,
) {
interaction { enabled(true) }
}
If your interaction config is served from a different host, you can override the URL locally:
interaction {
setConfigUrl { "https://your-config-host.com/v1/interaction-configs/" }
}
Telemetry Events Feed
Interactions are built from trackEvent() calls. Any event tracked via the SDK can participate in an interaction flow:
PulseSDK.INSTANCE.trackEvent("cart_viewed", System.currentTimeMillis())
PulseSDK.INSTANCE.trackEvent("checkout_started", System.currentTimeMillis())
PulseSDK.INSTANCE.trackEvent("payment_completed", System.currentTimeMillis())
When the server defines this as an interaction named "CheckoutFlow", the SDK emits a span covering the full duration with each event as a span event.
Example: Checkout Flow
Here's how a 3-step checkout interaction looks in practice. Each trackEvent() call lives wherever that action happens in your app:
// Step 1 — user opens cart (CartFragment.onResume)
PulseSDK.INSTANCE.trackEvent(
"cart_viewed",
System.currentTimeMillis(),
mapOf("cart.item_count" to 3, "cart.total" to 149.99)
)
// Step 2 — user taps "Proceed to Pay" (CheckoutFragment)
PulseSDK.INSTANCE.trackEvent(
"checkout_started",
System.currentTimeMillis(),
mapOf("payment.method" to "upi")
)
// Step 3 — payment confirmed (PaymentResultFragment)
PulseSDK.INSTANCE.trackEvent(
"payment_completed",
System.currentTimeMillis(),
mapOf("order.id" to "ORD-8821", "payment.status" to "success")
)
On the Pulse dashboard, define an interaction named CheckoutFlow with the trigger sequence cart_viewed → checkout_started → payment_completed. The SDK then emits a single span:
| Field | Value |
|---|---|
| Span name | CheckoutFlow |
| Span duration | Time from cart_viewed to payment_completed |
| Span events | 3 events, each with its attributes and timestamp |
| Span status | OK (or ERROR if any event in the sequence is marked errored) |
What Gets Tracked
| Telemetry | Description |
|---|---|
| Span name | Interaction name (defined in dashboard) |
| Span timing | Start of first event → end of last event |
| Span events | Each constituent event with its attributes and timestamp |
| Span status | ERROR if any event in the sequence is marked as errored |