@amplitude/amplitude-js-gtm
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},i=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},s=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(i(e,t,Array.prototype.slice.call(arguments)))}}},o=function(e){for(var t=0;t<v.length;t++)s(e,v[t],!1);for(var r=0;r<m.length;r++)s(e,m[r],!0)};r.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-D3GO8BuPsJOXpw91yAMykYKOR35cmmZ15qHBaEcl5aU3po1Xnyw2m+J4lL2+Cs1t",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/marketing-analytics-browser-0.4.0-min.js.gz",a.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var u=t.getElementsByTagName("script")[0];u.parentNode.insertBefore(a,u);for(var p=function(){return this._q=[],this},c=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],d=0;d<c.length;d++)n(p,c[d]);r.Identify=p;for(var l=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],y=0;y<f.length;y++)n(l,f[y]);r.Revenue=l;var v=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],m=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];o(r),r.createInstance=function(e){return r._iq[e]={_q:[]},o(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document),function(e,t){var r={};if(e.amplitude&&"function"==typeof e.amplitude.init){var n=["init","track","identify","setGroup","groupIdentify","revenue","flush","getUserId","setUserId","getSessionId","setSessionId","setDeviceId","getDeviceId","reset","setOptOut","setTransport"],i=["add","append","clearAll","prepend","set","setOnce","remove","preInsert","postInsert"],s=function(t,r,n){if(r=r.shift(),Array.isArray(r)&&0!==r.length){var s=new e.amplitude.Identify;if(r.forEach((function(e){if(Array.isArray(e)){var t=e.shift();-1!==i.indexOf(t)&&s[t].apply(s,e)}})),!0===n)return s;t.identify(s)}},o=function(e,t){if(!(t.length<3)&&"string"==typeof t[0]&&"string"==typeof t[1]&&Array.isArray(t[2])&&0!==t[2].length){var r=s(e,[t[2]],!0);e.groupIdentify(t[0],t[1],r)}},a=function(t,r){if((r=r.shift()).price&&r.productId){var n=(new e.amplitude.Revenue).setProductId(r.productId).setQuantity(r.quantity||1).setPrice(r.price).setRevenueType(r.revenueType||"").setEventProperties(r.eventProperties||{});t.revenue(n)}},u=function(e,t){let r=e.init(...t).promise;return r.then((()=>e.add({name:"gtm-library-enrichment",type:"enrichment",setup:async()=>{},execute:async e=>(e.library="amplitude-ts-gtm/3.1.0",e)}))),r};e[t]=e[t]||function(){var t=[].slice.call(arguments,0),i=t.shift();r[i]||(r[i]=e.amplitude.createInstance(i));var p=r[i],c=t.shift();if(-1!==n.indexOf(c))return"revenue"===c?a(p,t):"identify"===c?s(p,t):"groupIdentify"===c?o(p,t):"init"===c?u(p,t):p[c].apply(this,t)}}}(window,"_amplitude")})(); | ||
(()=>{"use strict";!function(e,t){var n=e.amplitude||{_q:[],_iq:{}};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},i=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},s=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(i(e,t,Array.prototype.slice.call(arguments)))}}},o=function(e){for(var t=0;t<v.length;t++)s(e,v[t],!1);for(var n=0;n<m.length;n++)s(e,m[n],!0)};n.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-D3GO8BuPsJOXpw91yAMykYKOR35cmmZ15qHBaEcl5aU3po1Xnyw2m+J4lL2+Cs1t",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/marketing-analytics-browser-0.4.0-min.js.gz",a.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var u=t.getElementsByTagName("script")[0];u.parentNode.insertBefore(a,u);for(var p=function(){return this._q=[],this},c=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],d=0;d<c.length;d++)r(p,c[d]);n.Identify=p;for(var l=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],y=0;y<f.length;y++)r(l,f[y]);n.Revenue=l;var v=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],m=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];o(n),n.createInstance=function(e){return n._iq[e]={_q:[]},o(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document),function(e,t){if(e.amplitude&&"function"==typeof e.amplitude.init){var n=["init","track","identify","setGroup","groupIdentify","revenue","flush","getUserId","setUserId","getSessionId","setSessionId","setDeviceId","getDeviceId","reset","setOptOut","setTransport"],r=["add","append","clearAll","prepend","set","setOnce","remove","preInsert","postInsert"],i=function(t,n,i){if(n=n.shift(),Array.isArray(n)&&0!==n.length){var s=new e.amplitude.Identify;if(n.forEach((function(e){if(Array.isArray(e)){var t=e.shift();-1!==r.indexOf(t)&&s[t].apply(s,e)}})),!0===i)return s;t.identify(s)}},s=function(e,t){if(!(t.length<3)&&"string"==typeof t[0]&&"string"==typeof t[1]&&Array.isArray(t[2])&&0!==t[2].length){var n=i(e,[t[2]],!0);e.groupIdentify(t[0],t[1],n)}},o=function(t,n){if((n=n.shift()).price&&n.productId){var r=(new e.amplitude.Revenue).setProductId(n.productId).setQuantity(n.quantity||1).setPrice(n.price).setRevenueType(n.revenueType||"").setEventProperties(n.eventProperties||{});t.revenue(r)}},a=function(e,t){let n=e.init(...t).promise;return n.then((()=>e.add({name:"gtm-library-enrichment",type:"enrichment",setup:async()=>{},execute:async e=>(e.library="amplitude-ts-gtm/3.1.1",e)}))),n};e[t]=e[t]||function(){var t=[].slice.call(arguments,0),r=t.shift(),u=e.amplitude._iq[r];u||(u=e.amplitude.createInstance(r));var p=t.shift();if(-1!==n.indexOf(p))return"revenue"===p?o(u,t):"identify"===p?i(u,t):"groupIdentify"===p?s(u,t):"init"===p?a(u,t):u[p].apply(this,t)}}}(window,"_amplitude")})(); |
{ | ||
"name": "@amplitude/amplitude-js-gtm", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "Amplitude JS SDK Wrapper for use with Google Tag Manager", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -9,4 +9,2 @@ import { version } from '../package.json'; | ||
(function(a,p) { | ||
var instances = {}; | ||
// If window.amplitude doesn't exist, return | ||
@@ -165,6 +163,6 @@ if (!a.amplitude || typeof a.amplitude.init !== 'function') return; | ||
var name = args.shift(); | ||
if (!instances[name]) { | ||
instances[name] = a.amplitude.createInstance(name); | ||
var client = a.amplitude._iq[name]; | ||
if (!client) { | ||
client = a.amplitude.createInstance(name); | ||
} | ||
var client = instances[name]; | ||
@@ -171,0 +169,0 @@ // Pick the first argument as the command |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22531
190