Skip to content

Commit 669bf99

Browse files
committed
update snippet in test html pages and add link to readme in docs
1 parent cf85d1b commit 669bf99

File tree

11 files changed

+45
-27
lines changed

11 files changed

+45
-27
lines changed

amplitude.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,8 @@ var _isNumber = function _isNumber(n) {
930930
/**
931931
* Log revenue with Revenue interface. The new revenue interface allows for more revenue fields like
932932
* revenueType and event properties.
933+
* See [Readme]{@link https://github.com/amplitude/Amplitude-Javascript#tracking-revenue}
934+
* for more information on the Revenue interface and logging revenue.
933935
* @public
934936
* @param {Revenue} revenue_obj - the revenue object containing the revenue data being logged.
935937
* @example var revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99);

documentation/Amplitude.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ <h4 class="name" id="__VERSION__"><span class="type-signature"></span>__VERSION_
184184

185185
<dt class="tag-source">Source:</dt>
186186
<dd class="tag-source"><ul class="dummy"><li>
187-
<a href="amplitude.js.html">amplitude.js</a>, <a href="amplitude.js.html#line1049">line 1049</a>
187+
<a href="amplitude.js.html">amplitude.js</a>, <a href="amplitude.js.html#line1051">line 1051</a>
188188
</li></ul></dd>
189189

190190

@@ -1212,7 +1212,7 @@ <h5>Parameters:</h5>
12121212

12131213
<dt class="tag-source">Source:</dt>
12141214
<dd class="tag-source"><ul class="dummy"><li>
1215-
<a href="amplitude.js.html">amplitude.js</a>, <a href="amplitude.js.html#line861">line 861</a>
1215+
<a href="amplitude.js.html">amplitude.js</a>, <a href="amplitude.js.html#line863">line 863</a>
12161216
</li></ul></dd>
12171217

12181218

@@ -1257,6 +1257,8 @@ <h4 class="name" id="logRevenueV2"><span class="type-signature"></span>logRevenu
12571257
<div class="description">
12581258
Log revenue with Revenue interface. The new revenue interface allows for more revenue fields like
12591259
revenueType and event properties.
1260+
See <a href="https://github.com/amplitude/Amplitude-Javascript#tracking-revenue">Readme</a>
1261+
for more information on the Revenue interface and logging revenue.
12601262
</div>
12611263

12621264

@@ -1349,7 +1351,7 @@ <h5>Parameters:</h5>
13491351

13501352
<dt class="tag-source">Source:</dt>
13511353
<dd class="tag-source"><ul class="dummy"><li>
1352-
<a href="amplitude.js.html">amplitude.js</a>, <a href="amplitude.js.html#line832">line 832</a>
1354+
<a href="amplitude.js.html">amplitude.js</a>, <a href="amplitude.js.html#line834">line 834</a>
13531355
</li></ul></dd>
13541356

13551357

@@ -1713,7 +1715,7 @@ <h4 class="name" id="setGlobalUserProperties"><span class="type-signature"></spa
17131715

17141716
<dt class="tag-source">Source:</dt>
17151717
<dd class="tag-source"><ul class="dummy"><li>
1716-
<a href="amplitude.js.html">amplitude.js</a>, <a href="amplitude.js.html#line1039">line 1039</a>
1718+
<a href="amplitude.js.html">amplitude.js</a>, <a href="amplitude.js.html#line1041">line 1041</a>
17171719
</li></ul></dd>
17181720

17191721

@@ -2483,7 +2485,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude
24832485
<br class="clear">
24842486

24852487
<footer>
2486-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Apr 20 2016 00:37:56 GMT-0700 (PDT)
2488+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Apr 20 2016 00:53:16 GMT-0700 (PDT)
24872489
</footer>
24882490

24892491
<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 Apr 20 2016 00:37:56 GMT-0700 (PDT)
1298+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Apr 20 2016 00:53:16 GMT-0700 (PDT)
12991299
</footer>
13001300

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

documentation/Revenue.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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 Apr 20 2016 00:37:56 GMT-0700 (PDT)
968+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Apr 20 2016 00:53:16 GMT-0700 (PDT)
969969
</footer>
970970

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

documentation/amplitude.js.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,8 @@ <h1 class="page-title">Source: amplitude.js</h1>
852852
/**
853853
* Log revenue with Revenue interface. The new revenue interface allows for more revenue fields like
854854
* revenueType and event properties.
855+
* See [Readme]{@link https://github.com/amplitude/Amplitude-Javascript#tracking-revenue}
856+
* for more information on the Revenue interface and logging revenue.
855857
* @public
856858
* @param {Revenue} revenue_obj - the revenue object containing the revenue data being logged.
857859
* @example var revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99);
@@ -1093,7 +1095,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude
10931095
<br class="clear">
10941096

10951097
<footer>
1096-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Apr 20 2016 00:37:56 GMT-0700 (PDT)
1098+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Apr 20 2016 00:53:16 GMT-0700 (PDT)
10971099
</footer>
10981100

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

documentation/identify.js.html

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

228228
<footer>
229-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Apr 20 2016 00:37:56 GMT-0700 (PDT)
229+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Apr 20 2016 00:53:16 GMT-0700 (PDT)
230230
</footer>
231231

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

documentation/index.html

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

5858
<footer>
59-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Apr 20 2016 00:37:56 GMT-0700 (PDT)
59+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Apr 20 2016 00:53:16 GMT-0700 (PDT)
6060
</footer>
6161

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

documentation/revenue.js.html

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

202202
<footer>
203-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Apr 20 2016 00:37:56 GMT-0700 (PDT)
203+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Apr 20 2016 00:53:16 GMT-0700 (PDT)
204204
</footer>
205205

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

src/amplitude.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,8 @@ var _isNumber = function _isNumber(n) {
824824
/**
825825
* Log revenue with Revenue interface. The new revenue interface allows for more revenue fields like
826826
* revenueType and event properties.
827+
* See [Readme]{@link https://github.com/amplitude/Amplitude-Javascript#tracking-revenue}
828+
* for more information on the Revenue interface and logging revenue.
827829
* @public
828830
* @param {Revenue} revenue_obj - the revenue object containing the revenue data being logged.
829831
* @example var revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99);

test/browser/amplitudejs.html

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,30 @@
1010
as.onload = function() {window.amplitude.runQueuedFunctions();};
1111
var s = document.getElementsByTagName('script')[0];
1212
s.parentNode.insertBefore(as, s);
13-
var Identify = function() {this._q = []; return this;};
14-
function proxyIdentify(fn) {
15-
Identify.prototype[fn] = function() {
13+
function proxy(obj, fn) {
14+
obj.prototype[fn] = function() {
1615
this._q.push([fn].concat(Array.prototype.slice.call(arguments, 0))); return this;
1716
};
1817
}
19-
var identifyFuncs = ['add', 'append', 'clearAll', 'set', 'setOnce', 'unset'];
20-
for (var i = 0; i < identifyFuncs.length; i++) {proxyIdentify(identifyFuncs[i]);}
18+
var Identify = function() {this._q = []; return this;};
19+
var identifyFuncs = ['add', 'append', 'clearAll', 'prepend', 'set', 'setOnce', 'unset'];
20+
for (var i = 0; i < identifyFuncs.length; i++) {proxy(Identify,identifyFuncs[i]);}
2121
amplitude.Identify = Identify;
22+
var Revenue = function() {this._q = []; return this;};
23+
var revenueFuncs = ['setProductId', 'setQuantity', 'setPrice', 'setRevenueType', 'setEventProperties'];
24+
for (var j = 0; j < revenueFuncs.length; j++) {proxy(Revenue, revenueFuncs[j]);}
25+
amplitude.Revenue = Revenue;
2226
var funcs = ['init', 'logEvent', 'logRevenue', 'setUserId', 'setUserProperties',
2327
'setOptOut', 'setVersionName', 'setDomain', 'setDeviceId',
24-
'setGlobalUserProperties', 'identify', 'clearUserProperties'];
28+
'setGlobalUserProperties', 'identify', 'clearUserProperties',
29+
'logRevenueV2'];
2530
function setUpProxy(instance) {
26-
function proxy(fn) {
31+
function proxyMain(fn) {
2732
instance[fn] = function() {
2833
instance._q.push([fn].concat(Array.prototype.slice.call(arguments, 0)));
2934
};
3035
}
31-
for (var j = 0; j < funcs.length; j++) {proxy(funcs[j]);}
36+
for (var k = 0; k < funcs.length; k++) {proxyMain(funcs[k]);}
3237
}
3338
setUpProxy(amplitude);
3439
window.amplitude = amplitude;

0 commit comments

Comments
 (0)