Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions amplitude-snippet.min.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
(function(e,t){var n=e.amplitude||{_q:[],_iq:{}};var r=t.createElement("script");r.type="text/javascript";
r.async=true;r.src="https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-3.4.0-min.gz.js";
r.onload=function(){e.amplitude.runQueuedFunctions()};var i=t.getElementsByTagName("script")[0];
i.parentNode.insertBefore(r,i);function s(e,t){e.prototype[t]=function(){this._q.push([t].concat(Array.prototype.slice.call(arguments,0)));
return this}}var o=function(){this._q=[];return this};var a=["add","append","clearAll","prepend","set","setOnce","unset"];
for(var u=0;u<a.length;u++){s(o,a[u])}n.Identify=o;var c=function(){this._q=[];return this;
};var p=["setProductId","setQuantity","setPrice","setRevenueType","setEventProperties"];
for(var l=0;l<p.length;l++){s(c,p[l])}n.Revenue=c;var d=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties","identify","clearUserProperties","setGroup","logRevenueV2","regenerateDeviceId","logEventWithTimestamp","logEventWithGroups"];
r.onload=function(){if(e.amplitude.runQueuedFunctions){e.amplitude.runQueuedFunctions();
}else{console.log("[Amplitude] Error: could not load SDK")}};var i=t.getElementsByTagName("script")[0];
i.parentNode.insertBefore(r,i);function o(e,t){e.prototype[t]=function(){this._q.push([t].concat(Array.prototype.slice.call(arguments,0)));
return this}}var s=function(){this._q=[];return this};var a=["add","append","clearAll","prepend","set","setOnce","unset"];
for(var u=0;u<a.length;u++){o(s,a[u])}n.Identify=s;var c=function(){this._q=[];return this;
};var l=["setProductId","setQuantity","setPrice","setRevenueType","setEventProperties"];
for(var p=0;p<l.length;p++){o(c,l[p])}n.Revenue=c;var d=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties","identify","clearUserProperties","setGroup","logRevenueV2","regenerateDeviceId","logEventWithTimestamp","logEventWithGroups"];
function v(e){function t(t){e[t]=function(){e._q.push([t].concat(Array.prototype.slice.call(arguments,0)));
}}for(var n=0;n<d.length;n++){t(d[n])}}v(n);n.getInstance=function(e){e=(!e||e.length===0?"$default_instance":e).toLowerCase();
if(!n._iq.hasOwnProperty(e)){n._iq[e]={_q:[]};v(n._iq[e])}return n._iq[e]};e.amplitude=n;
Expand Down
2 changes: 1 addition & 1 deletion src/amplitude-snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
as.type = 'text/javascript';
as.async = true;
as.src = 'https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-3.4.0-min.gz.js';
as.onload = function() {window.amplitude.runQueuedFunctions();};
as.onload = function() {if(window.amplitude.runQueuedFunctions) {window.amplitude.runQueuedFunctions();} else {console.log('[Amplitude] Error: could not load SDK');}};
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(as, s);
function proxy(obj, fn) {
Expand Down
3 changes: 2 additions & 1 deletion test/browser/amplitudejs.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
as.type = 'text/javascript';
as.async = true;
as.src = '/amplitude.js';
as.onload = function() {window.amplitude.runQueuedFunctions();};
as.onload = function() {if(window.amplitude.runQueuedFunctions) {window.amplitude.runQueuedFunctions();} else {console.log('[Amplitude] Error: could not load SDK');}};
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(as, s);
function proxy(obj, fn) {
Expand Down Expand Up @@ -47,6 +47,7 @@
window.amplitude = amplitude;
})(window, document);


var setUserId = function() {
var userId = prompt('Input userId', 'user01');
amplitude.setUserId(userId);
Expand Down
3 changes: 2 additions & 1 deletion test/browser/amplitudejs2.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
as.type = 'text/javascript';
as.async = true;
as.src = '/amplitude.js';
as.onload = function() {window.amplitude.runQueuedFunctions();};
as.onload = function() {if(window.amplitude.runQueuedFunctions) {window.amplitude.runQueuedFunctions();} else {console.log('[Amplitude] Error: could not load SDK');}};
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(as, s);
function proxy(obj, fn) {
Expand Down Expand Up @@ -47,6 +47,7 @@
window.amplitude = amplitude;
})(window, document);


var setUserId = function() {
var userId = prompt('Input userId', 'user01');
amplitude.setUserId(userId);
Expand Down