AMPRevenue Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | AMPRevenue.h AMPRevenue.m |
Overview
AMPRevenue objects are a wrapper for revenue data, which get passed to the logRevenueV2 method to send to Amplitude servers.
Note: price is a required field. If quantity is not specified, then defaults to 1.
Note: Revenue amount is calculated as price * quantity.
Each method updates a revenue property in the Revenue object, and returns the same Revenue object, allowing you to chain multiple method calls together.
Here is an example of how to use AMPRevenue to send revenue data:
AMPRevenue *revenue = [[[AMPRevenue revenue] setProductIdentifier:@"productIdentifier"] setQuantity:3];
[revenue setPrice:[NSNumber numberWithDouble:3.99]];
[[Amplitude instance] logRevenueV2:revenue];
See Tracking Revenue for more information about logging Revenue.
Other Methods
+ revenue
Creates a new AMPRevenue object.
+ (instancetype)revenueReturn Value
a new AMPRevenue object.
Discussion
Creates a new AMPRevenue object.
Declared In
AMPRevenue.h
– setProductIdentifier:
Set a value for the product identifier.
- (AMPRevenue *)setProductIdentifier:(NSString *)productIdentifierParameters
productIdentifier |
The value for the product identifier. Empty strings are ignored. |
|---|
Return Value
the same AMPRevenue object, allowing you to chain multiple method calls together.
Discussion
Set a value for the product identifier.
Declared In
AMPRevenue.h
– setQuantity:
Set a value for the quantity.
- (AMPRevenue *)setQuantity:(NSInteger)quantityParameters
quantity |
Integer value for the quantity. Defaults to 1 if not specified. |
|---|
Return Value
the same AMPRevenue object, allowing you to chain multiple method calls together.
Declared In
AMPRevenue.h
– setPrice:
Set a value for the price.
- (AMPRevenue *)setPrice:(NSNumber *)priceParameters
price |
The value for the price. |
|---|
Return Value
the same AMPRevenue object, allowing you to chain multiple method calls together.
Declared In
AMPRevenue.h
– setRevenueType:
Set a value for the revenueType (for example purchase, cost, tax, refund, etc).
- (AMPRevenue *)setRevenueType:(NSString *)revenueTypeParameters
revenueType |
String value for the revenue type. |
|---|
Return Value
the same AMPRevenue object, allowing you to chain multiple method calls together.
Discussion
Set a value for the revenueType (for example purchase, cost, tax, refund, etc).
Declared In
AMPRevenue.h
– setReceipt:
- (AMPRevenue *)setReceipt:(NSData *)receiptParameters
receipt |
The receipt data from the App Store. |
|---|
Return Value
the same AMPRevenue object, allowing you to chain multiple method calls together.
Discussion
Add the receipt data for the transaction. Reequired if you want to verify this revenue event.
Declared In
AMPRevenue.h
– setEventProperties:
Set event properties for the revenue event.
- (AMPRevenue *)setEventProperties:(NSDictionary *)eventPropertiesParameters
eventProperties |
An |
|---|
Return Value
the same AMPRevenue object, allowing you to chain multiple method calls together.
Discussion
Set event properties for the revenue event.
See Also
Declared In
AMPRevenue.h
Required Revenue Fields
productId
The product identifier for the transaction (optional).
@property (nonatomic, strong, readonly) NSString *productIdDiscussion
The product identifier for the transaction (optional).
Declared In
AMPRevenue.h
price
The price of product(s) in the transaction.
@property (nonatomic, strong, readonly) NSNumber *priceDiscussion
The price of product(s) in the transaction.
@warning: required field
Declared In
AMPRevenue.h
Optional Revenue Fields
quantity
The quantity of product(s) purchased in the transaction.
@property (nonatomic, readonly) NSInteger quantityDiscussion
The quantity of product(s) purchased in the transaction.
@warning: defaults to 1
Declared In
AMPRevenue.h