You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
## Unreleased
2
2
3
+
* Add `logRevenueV2` and new `Revenue` class to support logging revenue events with properties, and revenue type. See [Readme](https://github.com/amplitude/Amplitude-Javascript#tracking-revenue) for more info.
4
+
3
5
### 2.11.0 (April 14, 2016)
4
6
5
7
* Add tracking of each user's initial_utm parameters (which is captured as a set once operation). Utm parameters are now sent only once per user session.
The preferred method of tracking revenue for a user now is to use `logRevenueV2()`in conjunction with the provided `Revenue`interface. `Revenue` instances will store each revenue transaction and allow you to define several special revenue properties (such as revenueType, productId, etc) that are used in Amplitude dashboard's Revenue tab. You can now also add event properties to the revenue event, via the eventProperties field. These `Revenue` instance objects are then passed into `logRevenueV2` to send as revenue events to Amplitude servers. This allows us to automatically display data relevant to revenue on the Amplitude website, including average revenue per daily active user (ARPDAU), 1, 7, 14, 30, 60, and 90 day revenue, lifetime value (LTV) estimates, and revenue by advertising campaign cohort and daily/weekly/monthly cohorts.
188
189
190
+
Each time a user generates revenue, you create a `Revenue` object and fill out the revenue properties:
189
191
```javascript
190
-
amplitude.logRevenue(9.99, 1, 'product');
192
+
var revenue = new amplitude.Revenue().setProductId('com.company.productId').setPrice(3.99).setQuantity(3);
193
+
amplitude.logRevenueV2(revenue);
191
194
```
192
195
193
-
The function takes a unit price, a quantity, and a product identifier. Quantity and product identifier are optional parameters.
196
+
`productId` and `price` are required fields. `quantity` defaults to 1 if not specified. Each field has a corresponding `set` method (for example `setProductId`, `setQuantity`, etc). This table describes the different fields available:
194
197
195
-
This allows us to automatically display data relevant to revenue on the Amplitude website, including average revenue per daily active user (ARPDAU), 7, 30, and 90 day revenue, lifetime value (LTV) estimates, and revenue by advertising campaign cohort and daily/weekly/monthly cohorts.
| productId | String | Required: an identifier for the product (we recommend something like the Google Play Store product Id) | null |
201
+
| quantity | Integer | Required: the quantity of products purchased. Defaults to 1 if not specified. Revenue = quantity * price | 1 |
202
+
| price | Double | Required: the price of the products purchased (can be negative). Revenue = quantity * price | null |
203
+
| revenueType | String | Optional: the type of revenue (ex: tax, refund, income) | null |
204
+
| eventProperties | Object | Optional: an object of event properties to include in the revenue event | null |
205
+
206
+
Note: the price can be negative, which might be useful for tracking revenue lost, for example refunds or costs. Also note, you can set event properties on the revenue event just as you would with logEvent by passing in a object of string key value pairs. These event properties, however, will only appear in the Event Segmentation tab, not in the Revenue tab.
207
+
208
+
### Backwards compatibility ###
209
+
210
+
The existing `logRevenue` methods still work but are deprecated. Fields such as `revenueType` will be missing from events logged with the old methods, so Revenue segmentation on those events will be limited in Amplitude dashboards.
0 commit comments