avo-mparticle-sdk-javascript
Advanced tools
Comparing version 1.0.2 to 1.0.3
40
index.js
@@ -6,2 +6,5 @@ var apiKey; | ||
window.mParticle = window.mParticle || {}; | ||
window.mParticle.eCommerce = {Cart: {}}; | ||
window.mParticle.Identity = {}; | ||
window.mParticle.config = window.mParticle.config || { | ||
@@ -14,2 +17,37 @@ isDevelopmentMode: options.isDevelopmentMode === true | ||
}; | ||
function a(o, t) { | ||
return function() { | ||
t && (o = t + '.' + o); | ||
var e = Array.prototype.slice.call(arguments); | ||
e.unshift(o), window.mParticle.config.rq.push(e); | ||
}; | ||
} | ||
var x = [ | ||
'endSession', | ||
'logError', | ||
'logEvent', | ||
'logForm', | ||
'logLink', | ||
'logPageView', | ||
'setSessionAttribute', | ||
'setAppName', | ||
'setAppVersion', | ||
'setOptOut', | ||
'setPosition', | ||
'startNewSession', | ||
'startTrackingLocation', | ||
'stopTrackingLocation' | ||
], | ||
y = ['setCurrencyCode', 'logCheckout'], | ||
z = ['login', 'logout', 'modify']; | ||
x.forEach(function(o) { | ||
window.mParticle[o] = a(o); | ||
}), | ||
y.forEach(function(o) { | ||
window.mParticle.eCommerce[o] = a(o, 'eCommerce'); | ||
}), | ||
z.forEach(function(o) { | ||
window.mParticle.Identity[o] = a(o, 'Identity'); | ||
}); | ||
var mp = document.createElement('script'); | ||
@@ -22,3 +60,3 @@ mp.type = 'text/javascript'; | ||
: 'http://jssdkcdn') + | ||
'.mparticle.com/js/v1/' + | ||
'.mparticle.com/js/v2/' + | ||
apiKey + | ||
@@ -25,0 +63,0 @@ '/mparticle.js'; |
{ | ||
"name": "avo-mparticle-sdk-javascript", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
3376
113