AmplitudeRevenueEvent

data class AmplitudeRevenueEvent(val name: String, val price: Double, val quantity: Int = 1, val productId: String? = null, val revenueType: String? = null, val currency: String? = null, val revenue: Double? = null, val receipt: String? = null, val receiptSig: String? = null, val insertId: String? = null, val parameters: Map<String, AnalyticsValue> = emptyMap()) : Event(source)

A purchase as Amplitude's revenue API takes it, so it lands in Amplitude's revenue charts and LTV rather than as an ordinary event. The fields are Amplitude's Revenue fields, under Amplitude's names.

A final class, so an app event can't be one. The app's Amplitude factory builds one from its own event and sends it through RevenueEventTracker.

Constructors

Link copied to clipboard
constructor(name: String, price: Double, quantity: Int = 1, productId: String? = null, revenueType: String? = null, currency: String? = null, revenue: Double? = null, receipt: String? = null, receiptSig: String? = null, insertId: String? = null, parameters: Map<String, AnalyticsValue> = emptyMap())

Properties

Link copied to clipboard

ISO 4217 code. Absent, Amplitude assumes USD.

Link copied to clipboard

The transaction id, so a purchase that is reported twice — a retried callback, a restored receipt — is counted once. Amplitude drops an event whose insert id it has already seen. Absent by default, which counts every report.

Link copied to clipboard
open override val name: String

Usually the app event's own. It isn't sent: Amplitude uses its own revenue event type.

Link copied to clipboard
open override val parameters: Map<String, AnalyticsValue>

Sent as the revenue's event properties. Usually the app event's own.

Link copied to clipboard

The price of one item. Amplitude drops a revenue event without one.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The total, when it is not price × quantity — after a discount, say.

Link copied to clipboard

Amplitude's free-form revenue category — purchase, refund, subscription, ...

Functions

Link copied to clipboard

Builds the Amplitude payload for revenue, with AmplitudeRevenueEvent.parameters as its properties. Public because a custom AmplitudeEventTracker almost always needs it.