Skip to main content

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.

PulseSDK.INSTANCE.initialize(
application = this,
apiKey = "your-api-key",
dataCollectionState = PulseDataCollectionConsent.ALLOWED,
) {
interaction { enabled(true) }
}

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:

FieldValue
Span nameCheckoutFlow
Span durationTime from cart_viewed to payment_completed
Span events3 events, each with its attributes and timestamp
Span statusOK (or ERROR if any event in the sequence is marked errored)

What Gets Tracked​

TelemetryDescription
Span nameInteraction name (defined in dashboard)
Span timingStart of first event → end of last event
Span eventsEach constituent event with its attributes and timestamp
Span statusERROR if any event in the sequence is marked as errored

Next Steps​