@amplitude/marketing-analytics-browser
Advanced tools
Comparing version 0.3.6 to 0.4.0
@@ -5,2 +5,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var amplitude = tslib_1.__importStar(require("./index")); | ||
var browser_client_1 = require("./browser-client"); | ||
var analytics_browser_1 = require("@amplitude/analytics-browser"); | ||
@@ -14,3 +15,15 @@ // https://developer.mozilla.org/en-US/docs/Glossary/IIFE | ||
} | ||
GlobalScope.amplitude = Object.assign(GlobalScope.amplitude || {}, amplitude); | ||
var createNamedInstance = function (instanceName) { | ||
var instance = (0, browser_client_1.createInstance)(); | ||
var GlobalScope = (0, analytics_client_common_1.getGlobalScope)(); | ||
if (GlobalScope && GlobalScope.amplitude && GlobalScope.amplitude._iq && instanceName) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
GlobalScope.amplitude._iq[instanceName] = instance; | ||
} | ||
return instance; | ||
}; | ||
GlobalScope.amplitude = Object.assign(GlobalScope.amplitude || {}, amplitude, { | ||
createInstance: createNamedInstance, | ||
}); | ||
if (GlobalScope.amplitude.invoked) { | ||
@@ -20,4 +33,6 @@ var queue = GlobalScope.amplitude._q; | ||
(0, analytics_browser_1.runQueuedFunctions)(amplitude, queue); | ||
for (var i = 0; i < GlobalScope.amplitude._iq.length; i++) { | ||
var instance = Object.assign(GlobalScope.amplitude._iq[i], amplitude.createInstance()); | ||
var instanceNames = Object.keys(GlobalScope.amplitude._iq) || []; | ||
for (var i = 0; i < instanceNames.length; i++) { | ||
var instanceName = instanceNames[i]; | ||
var instance = Object.assign(GlobalScope.amplitude._iq[instanceName], createNamedInstance(instanceName)); | ||
var queue_1 = instance._q; | ||
@@ -24,0 +39,0 @@ instance._q = []; |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.3.6"; | ||
export declare const VERSION = "0.4.0"; | ||
//# sourceMappingURL=version.d.ts.map |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '0.3.6'; | ||
exports.VERSION = '0.4.0'; | ||
//# sourceMappingURL=version.js.map |
import { getGlobalScope } from '@amplitude/analytics-client-common'; | ||
import * as amplitude from './index'; | ||
import { createInstance } from './browser-client'; | ||
import { runQueuedFunctions } from '@amplitude/analytics-browser'; | ||
@@ -11,3 +12,15 @@ // https://developer.mozilla.org/en-US/docs/Glossary/IIFE | ||
} | ||
GlobalScope.amplitude = Object.assign(GlobalScope.amplitude || {}, amplitude); | ||
var createNamedInstance = function (instanceName) { | ||
var instance = createInstance(); | ||
var GlobalScope = getGlobalScope(); | ||
if (GlobalScope && GlobalScope.amplitude && GlobalScope.amplitude._iq && instanceName) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
GlobalScope.amplitude._iq[instanceName] = instance; | ||
} | ||
return instance; | ||
}; | ||
GlobalScope.amplitude = Object.assign(GlobalScope.amplitude || {}, amplitude, { | ||
createInstance: createNamedInstance, | ||
}); | ||
if (GlobalScope.amplitude.invoked) { | ||
@@ -17,4 +30,6 @@ var queue = GlobalScope.amplitude._q; | ||
runQueuedFunctions(amplitude, queue); | ||
for (var i = 0; i < GlobalScope.amplitude._iq.length; i++) { | ||
var instance = Object.assign(GlobalScope.amplitude._iq[i], amplitude.createInstance()); | ||
var instanceNames = Object.keys(GlobalScope.amplitude._iq) || []; | ||
for (var i = 0; i < instanceNames.length; i++) { | ||
var instanceName = instanceNames[i]; | ||
var instance = Object.assign(GlobalScope.amplitude._iq[instanceName], createNamedInstance(instanceName)); | ||
var queue_1 = instance._q; | ||
@@ -21,0 +36,0 @@ instance._q = []; |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.3.6"; | ||
export declare const VERSION = "0.4.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export var VERSION = '0.3.6'; | ||
export var VERSION = '0.4.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,1 +0,1 @@ | ||
!function(){"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}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<m.length;t++)o(e,m[t],!1);for(var r=0;r<g.length;r++)o(e,g[r],!0)};r.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-JFzjvfvTp7MZX3Uabwzj3ryOpBWT9q1WXlKS9mFS3oEmiHRgYpmLHaNLlhuvWxUL",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/marketing-analytics-browser-0.3.6-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 c=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],l=0;l<p.length;l++)n(c,p[l]);r.Identify=c;for(var d=function(){return this._q=[],this},v=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],f=0;f<v.length;f++)n(d,v[f]);r.Revenue=d;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],g=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(){var e=r._iq.push({_q:[]})-1;return i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}(); | ||
!function(){"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}},s=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},o=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<m.length;t++)o(e,m[t],!1);for(var n=0;n<y.length;n++)o(e,y[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 c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(a,c);for(var u=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)r(u,l[p]);n.Identify=u;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)r(d,f[v]);n.Revenue=d;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],y=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(n),n.createInstance=function(e){return n._iq[e]={_q:[]},i(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document)}(); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.3.6"; | ||
export declare const VERSION = "0.4.0"; | ||
//# sourceMappingURL=version.d.ts.map |
{ | ||
"name": "@amplitude/marketing-analytics-browser", | ||
"version": "0.3.6", | ||
"version": "0.4.0", | ||
"description": "Official Amplitude SDK for Web and Marketing Analytics", | ||
@@ -45,8 +45,8 @@ "keywords": [ | ||
"dependencies": { | ||
"@amplitude/analytics-browser": "^1.7.1", | ||
"@amplitude/analytics-client-common": "^0.5.3", | ||
"@amplitude/analytics-core": "^0.11.3", | ||
"@amplitude/analytics-types": "^0.15.0", | ||
"@amplitude/plugin-page-view-tracking-browser": "^0.5.6", | ||
"@amplitude/plugin-web-attribution-browser": "^0.5.6", | ||
"@amplitude/analytics-browser": "^1.8.0", | ||
"@amplitude/analytics-client-common": "^0.5.4", | ||
"@amplitude/analytics-core": "^0.11.4", | ||
"@amplitude/analytics-types": "^0.16.0", | ||
"@amplitude/plugin-page-view-tracking-browser": "^0.5.7", | ||
"@amplitude/plugin-web-attribution-browser": "^0.5.7", | ||
"tslib": "^2.4.1" | ||
@@ -69,3 +69,3 @@ }, | ||
], | ||
"gitHead": "dba664d43a3a7c758b694ce36edc5da61dab29e1" | ||
"gitHead": "e9b73ad53882d499ca14e3d53e8885825554d0d9" | ||
} |
@@ -43,3 +43,3 @@ <p align="center"> | ||
<script type="text/javascript"> | ||
!function(){"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}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<m.length;t++)o(e,m[t],!1);for(var r=0;r<g.length;r++)o(e,g[r],!0)};r.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-JFzjvfvTp7MZX3Uabwzj3ryOpBWT9q1WXlKS9mFS3oEmiHRgYpmLHaNLlhuvWxUL",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/marketing-analytics-browser-0.3.6-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 c=function(){return this._q=[],this},p=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],l=0;l<p.length;l++)n(c,p[l]);r.Identify=c;for(var d=function(){return this._q=[],this},v=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],f=0;f<v.length;f++)n(d,v[f]);r.Revenue=d;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],g=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(){var e=r._iq.push({_q:[]})-1;return i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}(); | ||
!function(){"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}},s=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},o=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<m.length;t++)o(e,m[t],!1);for(var n=0;n<y.length;n++)o(e,y[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 c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(a,c);for(var u=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)r(u,l[p]);n.Identify=u;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)r(d,f[v]);n.Revenue=d;var m=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],y=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(n),n.createInstance=function(e){return n._iq[e]={_q:[]},i(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document)}(); | ||
@@ -46,0 +46,0 @@ amplitude.init("YOUR_API_KEY_HERE"); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
265171
943
- Removed@amplitude/analytics-types@0.15.0(transitive)