Skip to content

Commit b1e0b4c

Browse files
committed
add revenue class, revenue tests, updated snippet to proxy revenue
1 parent eb67967 commit b1e0b4c

17 files changed

+1509
-40
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ This Readme will guide you through using Amplitude's Javascript SDK to track use
1313
<script type="text/javascript">
1414
(function(e,t){var n=e.amplitude||{_q:[]};var r=t.createElement("script");r.type="text/javascript";
1515
r.async=true;r.src="https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-2.11.0-min.gz.js";
16-
r.onload=function(){e.amplitude.runQueuedFunctions()};var i=t.getElementsByTagName("script")[0];
17-
i.parentNode.insertBefore(r,i);var s=function(){this._q=[];return this};function o(e){
18-
s.prototype[e]=function(){this._q.push([e].concat(Array.prototype.slice.call(arguments,0)));
19-
return this}}var a=["add","append","clearAll","prepend","set","setOnce","unset"];for(var c=0;c<a.length;c++){
20-
o(a[c])}n.Identify=s;var u=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties","identify","clearUserProperties"];
21-
function p(e){function t(t){e[t]=function(){e._q.push([t].concat(Array.prototype.slice.call(arguments,0)));
22-
}}for(var n=0;n<u.length;n++){t(u[n])}}p(n);e.amplitude=n})(window,document);
16+
r.onload=function(){e.amplitude.runQueuedFunctions()};var s=t.getElementsByTagName("script")[0];
17+
s.parentNode.insertBefore(r,s);function i(e,t){e.prototype[t]=function(){this._q.push([t].concat(Array.prototype.slice.call(arguments,0)));
18+
return this}}var o=function(){this._q=[];return this};var a=["add","append","clearAll","prepend","set","setOnce","unset"];
19+
for(var u=0;u<a.length;u++){i(o,a[u])}n.Identify=o;var c=function(){this._q=[];return this;
20+
};var p=["setProductId","setQuantity","setPrice","setRevenueType","setRevenueProperties"];
21+
for(var l=0;l<p.length;l++){i(c,p[l])}n.Revenue=c;var d=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties","identify","clearUserProperties"];
22+
function v(e){function t(t){e[t]=function(){e._q.push([t].concat(Array.prototype.slice.call(arguments,0)));
23+
}}for(var n=0;n<d.length;n++){t(d[n])}}v(n);e.amplitude=n})(window,document);
2324
2425
amplitude.init("YOUR_API_KEY_HERE");
2526
</script>

amplitude-segment-snippet.min.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
(function(e,t){var n=e.amplitude||{_q:[]};var r=function(){this._q=[];return this;
2-
};function i(e){r.prototype[e]=function(){this._q.push([e].concat(Array.prototype.slice.call(arguments,0)));
3-
return this}}var o=["add","append","clearAll","prepend","set","setOnce","unset"];for(var s=0;s<o.length;s++){
4-
i(o[s])}n.Identify=r;var a=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties","identify","clearUserProperties"];
5-
function c(e){function t(t){e[t]=function(){e._q.push([t].concat(Array.prototype.slice.call(arguments,0)));
6-
}}for(var n=0;n<a.length;n++){t(a[n])}}c(n);e.amplitude=n})(window,document);
1+
(function(e,t){var r=e.amplitude||{_q:[]};function n(e,t){e.prototype[t]=function(){
2+
this._q.push([t].concat(Array.prototype.slice.call(arguments,0)));return this}}var s=function(){
3+
this._q=[];return this};var i=["add","append","clearAll","prepend","set","setOnce","unset"];
4+
for(var o=0;o<i.length;o++){n(s,i[o])}r.Identify=s;var a=function(){this._q=[];return this;
5+
};var u=["setProductId","setQuantity","setPrice","setRevenueType","setRevenueProperties"];
6+
for(var c=0;c<u.length;c++){n(a,u[c])}r.Revenue=a;var p=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties","identify","clearUserProperties"];
7+
function l(e){function t(t){e[t]=function(){e._q.push([t].concat(Array.prototype.slice.call(arguments,0)));
8+
}}for(var r=0;r<p.length;r++){t(p[r])}}l(r);e.amplitude=r})(window,document);

amplitude-snippet.min.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
(function(e,t){var n=e.amplitude||{_q:[]};var r=t.createElement("script");r.type="text/javascript";
22
r.async=true;r.src="https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-2.11.0-min.gz.js";
3-
r.onload=function(){e.amplitude.runQueuedFunctions()};var i=t.getElementsByTagName("script")[0];
4-
i.parentNode.insertBefore(r,i);var s=function(){this._q=[];return this};function o(e){
5-
s.prototype[e]=function(){this._q.push([e].concat(Array.prototype.slice.call(arguments,0)));
6-
return this}}var a=["add","append","clearAll","prepend","set","setOnce","unset"];for(var c=0;c<a.length;c++){
7-
o(a[c])}n.Identify=s;var u=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties","identify","clearUserProperties"];
8-
function p(e){function t(t){e[t]=function(){e._q.push([t].concat(Array.prototype.slice.call(arguments,0)));
9-
}}for(var n=0;n<u.length;n++){t(u[n])}}p(n);e.amplitude=n})(window,document);
3+
r.onload=function(){e.amplitude.runQueuedFunctions()};var s=t.getElementsByTagName("script")[0];
4+
s.parentNode.insertBefore(r,s);function i(e,t){e.prototype[t]=function(){this._q.push([t].concat(Array.prototype.slice.call(arguments,0)));
5+
return this}}var o=function(){this._q=[];return this};var a=["add","append","clearAll","prepend","set","setOnce","unset"];
6+
for(var u=0;u<a.length;u++){i(o,a[u])}n.Identify=o;var c=function(){this._q=[];return this;
7+
};var p=["setProductId","setQuantity","setPrice","setRevenueType","setRevenueProperties"];
8+
for(var l=0;l<p.length;l++){i(c,p[l])}n.Revenue=c;var d=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties","identify","clearUserProperties"];
9+
function v(e){function t(t){e[t]=function(){e._q.push([t].concat(Array.prototype.slice.call(arguments,0)));
10+
}}for(var n=0;n<d.length;n++){t(d[n])}}v(n);e.amplitude=n})(window,document);

amplitude.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,13 @@ module.exports = {
11381138
OPT_OUT: 'amplitude_optOut',
11391139
USER_ID: 'amplitude_userId',
11401140

1141-
COOKIE_TEST: 'amplitude_cookie_test'
1141+
COOKIE_TEST: 'amplitude_cookie_test',
1142+
1143+
// revenue keys
1144+
REVENUE_PRODUCT_ID: '$productId',
1145+
REVENUE_QUANTITY: '$quantity',
1146+
REVENUE_PRICE: '$price',
1147+
REVENUE_REVENUE_TYPE: '$revenueType'
11421148
};
11431149

11441150
}, {}],

amplitude.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

documentation/Amplitude.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,13 +2337,13 @@ <h5>Parameters:</h5>
23372337
</div>
23382338

23392339
<nav>
2340-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude.html">Amplitude</a></li><li><a href="Identify.html">Identify</a></li></ul>
2340+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude.html">Amplitude</a></li><li><a href="Identify.html">Identify</a></li><li><a href="Revenue.html">Revenue</a></li></ul>
23412341
</nav>
23422342

23432343
<br class="clear">
23442344

23452345
<footer>
2346-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Apr 05 2016 14:28:54 GMT-0700 (PDT)
2346+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Apr 18 2016 22:09:04 GMT-0700 (PDT)
23472347
</footer>
23482348

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

documentation/Identify.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,13 +1289,13 @@ <h5>Example</h5>
12891289
</div>
12901290

12911291
<nav>
1292-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude.html">Amplitude</a></li><li><a href="Identify.html">Identify</a></li></ul>
1292+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Amplitude.html">Amplitude</a></li><li><a href="Identify.html">Identify</a></li><li><a href="Revenue.html">Revenue</a></li></ul>
12931293
</nav>
12941294

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 Apr 05 2016 14:28:54 GMT-0700 (PDT)
1298+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Apr 18 2016 22:09:04 GMT-0700 (PDT)
12991299
</footer>
13001300

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

0 commit comments

Comments
 (0)