Skip to content

Commit 347017c

Browse files
committed
merge update revenue
2 parents 17f3f51 + 581167b commit 347017c

15 files changed

+30
-41
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Unreleased
22

3+
* `productId` is no longer a required field for `Revenue` logged via `logRevenueV2`.
34
* Track raw user agent string for backend filtering.
45

56
### 3.0.1 (June 22, 2016)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ var revenue = new amplitude.Revenue().setProductId('com.company.productId').setP
270270
amplitude.getInstance().logRevenueV2(revenue);
271271
```
272272
273-
`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:
273+
`price` is a required field. `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:
274274
275275
| Name | Type | Description | default |
276276
|--------------------|------------|----------------------------------------------------------------------------------------------------------|---------|

amplitude.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3816,14 +3816,14 @@ var utils = require('./utils');
38163816

38173817
/*
38183818
* Wrapper for logging Revenue data. Revenue objects get passed to amplitude.logRevenueV2 to send to Amplitude servers.
3819-
* Note: productId and price are required fields. If quantity is not specified, then defaults to 1.
3819+
* Note: price is the only required field. If quantity is not specified, then defaults to 1.
38203820
*/
38213821

38223822
/**
38233823
* Revenue API - instance constructor. Revenue objects are a wrapper for revenue data.
38243824
* Each method updates a revenue property in the Revenue object, and returns the same Revenue object,
38253825
* allowing you to chain multiple method calls together.
3826-
* Note: productId and price are required fields to log revenue events.
3826+
* Note: price is a required field to log revenue events.
38273827
* If quantity is not specified then defaults to 1.
38283828
* See [Readme]{@link https://github.com/amplitude/Amplitude-Javascript#tracking-revenue} for more information
38293829
* about logging Revenue.
@@ -3833,17 +3833,17 @@ var utils = require('./utils');
38333833
*/
38343834
var Revenue = function Revenue() {
38353835
// required fields
3836-
this._productId = null;
3837-
this._quantity = 1;
38383836
this._price = null;
38393837

38403838
// optional fields
3839+
this._productId = null;
3840+
this._quantity = 1;
38413841
this._revenueType = null;
38423842
this._properties = null;
38433843
};
38443844

38453845
/**
3846-
* Set a value for the product identifer. This field is required for all revenue being logged.
3846+
* Set a value for the product identifer.
38473847
* @public
38483848
* @param {string} productId - The value for the product identifier. Empty and invalid strings are ignored.
38493849
* @return {Revenue} Returns the same Revenue object, allowing you to chain multiple method calls together.
@@ -3935,10 +3935,6 @@ Revenue.prototype.setEventProperties = function setEventProperties(eventProperti
39353935
* @private
39363936
*/
39373937
Revenue.prototype._isValidRevenue = function _isValidRevenue() {
3938-
if (type(this._productId) !== 'string' || utils.isEmptyString(this._productId)) {
3939-
utils.log('Invalid revenue, need to set productId field');
3940-
return false;
3941-
}
39423938
if (type(this._price) !== 'number') {
39433939
utils.log('Invalid revenue, need to set price field');
39443940
return false;

amplitude.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

documentation/Amplitude.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3137,7 +3137,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude
31373137
<br class="clear">
31383138

31393139
<footer>
3140-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jul 05 2016 14:48:35 GMT-0700 (PDT)
3140+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Jul 06 2016 13:45:46 GMT-0700 (PDT)
31413141
</footer>
31423142

31433143
<script> prettyPrint(); </script>

documentation/AmplitudeClient.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2791,7 +2791,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude
27912791
<br class="clear">
27922792

27932793
<footer>
2794-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jul 05 2016 14:48:35 GMT-0700 (PDT)
2794+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Jul 06 2016 13:45:46 GMT-0700 (PDT)
27952795
</footer>
27962796

27972797
<script> prettyPrint(); </script>

documentation/Identify.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude
12951295
<br class="clear">
12961296

12971297
<footer>
1298-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jul 05 2016 14:48:35 GMT-0700 (PDT)
1298+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Jul 06 2016 13:45:46 GMT-0700 (PDT)
12991299
</footer>
13001300

13011301
<script> prettyPrint(); </script>

documentation/Revenue.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ <h4 class="name" id="Revenue"><span class="type-signature"></span>new Revenue<sp
5050
Revenue API - instance constructor. Revenue objects are a wrapper for revenue data.
5151
Each method updates a revenue property in the Revenue object, and returns the same Revenue object,
5252
allowing you to chain multiple method calls together.
53-
Note: productId and price are required fields to log revenue events.
53+
Note: price is a required field to log revenue events.
5454
If quantity is not specified then defaults to 1.
5555
See <a href="https://github.com/amplitude/Amplitude-Javascript#tracking-revenue">Readme</a> for more information
5656
about logging Revenue.
@@ -478,7 +478,7 @@ <h4 class="name" id="setProductId"><span class="type-signature"></span>setProduc
478478

479479

480480
<div class="description">
481-
Set a value for the product identifer. This field is required for all revenue being logged.
481+
Set a value for the product identifer.
482482
</div>
483483

484484

@@ -965,7 +965,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude
965965
<br class="clear">
966966

967967
<footer>
968-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jul 05 2016 14:48:35 GMT-0700 (PDT)
968+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Jul 06 2016 13:45:46 GMT-0700 (PDT)
969969
</footer>
970970

971971
<script> prettyPrint(); </script>

documentation/amplitude-client.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude
11731173
<br class="clear">
11741174

11751175
<footer>
1176-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jul 05 2016 14:48:35 GMT-0700 (PDT)
1176+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Jul 06 2016 13:45:46 GMT-0700 (PDT)
11771177
</footer>
11781178

11791179
<script> prettyPrint(); </script>

documentation/amplitude.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude
409409
<br class="clear">
410410

411411
<footer>
412-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jul 05 2016 14:48:35 GMT-0700 (PDT)
412+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Jul 06 2016 13:45:46 GMT-0700 (PDT)
413413
</footer>
414414

415415
<script> prettyPrint(); </script>

0 commit comments

Comments
 (0)