Skip to content

Commit 581167b

Browse files
committed
productid is no longer required field for revenue logged via logrevenuev2
1 parent ed405af commit 581167b

15 files changed

+31
-41
lines changed

CHANGELOG.md

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

3+
* `productId` is no longer a required field for `Revenue` logged via `logRevenueV2`.
4+
35
### 3.0.1 (June 22, 2016)
46

57
* Update README with link to our [Google Tag Manager integration demo app](https://github.com/amplitude/GTM-Web-Demo).

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
@@ -3813,14 +3813,14 @@ var utils = require('./utils');
38133813

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

38193819
/**
38203820
* Revenue API - instance constructor. Revenue objects are a wrapper for revenue data.
38213821
* Each method updates a revenue property in the Revenue object, and returns the same Revenue object,
38223822
* allowing you to chain multiple method calls together.
3823-
* Note: productId and price are required fields to log revenue events.
3823+
* Note: price is a required field to log revenue events.
38243824
* If quantity is not specified then defaults to 1.
38253825
* See [Readme]{@link https://github.com/amplitude/Amplitude-Javascript#tracking-revenue} for more information
38263826
* about logging Revenue.
@@ -3830,17 +3830,17 @@ var utils = require('./utils');
38303830
*/
38313831
var Revenue = function Revenue() {
38323832
// required fields
3833-
this._productId = null;
3834-
this._quantity = 1;
38353833
this._price = null;
38363834

38373835
// optional fields
3836+
this._productId = null;
3837+
this._quantity = 1;
38383838
this._revenueType = null;
38393839
this._properties = null;
38403840
};
38413841

38423842
/**
3843-
* Set a value for the product identifer. This field is required for all revenue being logged.
3843+
* Set a value for the product identifer.
38443844
* @public
38453845
* @param {string} productId - The value for the product identifier. Empty and invalid strings are ignored.
38463846
* @return {Revenue} Returns the same Revenue object, allowing you to chain multiple method calls together.
@@ -3932,10 +3932,6 @@ Revenue.prototype.setEventProperties = function setEventProperties(eventProperti
39323932
* @private
39333933
*/
39343934
Revenue.prototype._isValidRevenue = function _isValidRevenue() {
3935-
if (type(this._productId) !== 'string' || utils.isEmptyString(this._productId)) {
3936-
utils.log('Invalid revenue, need to set productId field');
3937-
return false;
3938-
}
39393935
if (type(this._price) !== 'number') {
39403936
utils.log('Invalid revenue, need to set price field');
39413937
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 Wed Jun 22 2016 14:19:08 GMT-0700 (PDT)
3140+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jul 05 2016 16:41:28 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 Wed Jun 22 2016 14:19:08 GMT-0700 (PDT)
2794+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jul 05 2016 16:41:28 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 Wed Jun 22 2016 14:19:08 GMT-0700 (PDT)
1298+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jul 05 2016 16:41:28 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 Wed Jun 22 2016 14:19:08 GMT-0700 (PDT)
968+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jul 05 2016 16:41:28 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
@@ -1170,7 +1170,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude
11701170
<br class="clear">
11711171

11721172
<footer>
1173-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Jun 22 2016 14:19:08 GMT-0700 (PDT)
1173+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jul 05 2016 16:41:28 GMT-0700 (PDT)
11741174
</footer>
11751175

11761176
<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 Wed Jun 22 2016 14:19:08 GMT-0700 (PDT)
412+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Jul 05 2016 16:41:28 GMT-0700 (PDT)
413413
</footer>
414414

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

0 commit comments

Comments
 (0)