Revenue
Revenue()
Revenue API - instance constructor. Wrapper for logging Revenue data. Revenue objects get passed to amplitude.logRevenueV2 to send to Amplitude servers. Each method updates a revenue property in the Revenue object, and returns the same Revenue object, allowing you to chain multiple method calls together.
Note: price is a required field to log revenue events. If quantity is not specified then defaults to 1.
Revenue#setProductId
Set a value for the product identifer.
Parameters
productId
(string
) The value for the product identifier. Empty and invalid strings are ignored.
Return Value
- (
Revenue
) Returns the same Revenue object, allowing you to chain multiple method calls together.
Revenue#setQuantity
Set a value for the quantity. Note revenue amount is calculated as price * quantity.
Parameters
quantity
(number
) Integer value for the quantity. If not set, quantity defaults to 1.
Return Value
- (
Revenue
) Returns the same Revenue object, allowing you to chain multiple method calls together.
Revenue#setPrice
Set a value for the price. This field is required for all revenue being logged.
Note: revenue amount is calculated as price * quantity.
Parameters
price
(number
) Double value for the quantity.
Return Value
- (
Revenue
) Returns the same Revenue object, allowing you to chain multiple method calls together.
Revenue#setRevenueType
Set a value for the revenueType (for example purchase, cost, tax, refund, etc).
Parameters
revenueType
(string
) RevenueType to designate.
Return Value
- (
Revenue
) Returns the same Revenue object, allowing you to chain multiple method calls together.
Revenue#setEventProperties
Set event properties for the revenue event.
Parameters
eventProperties
(object
) Revenue event properties to set.
Return Value
- (
Revenue
) Returns the same Revenue object, allowing you to chain multiple method calls together.