@mparticle/web-google-analytics-kit
Advanced tools
Comparing version 2.1.9 to 2.1.10
## Releases | ||
-- | ||
- fix: Set custom dimensions for product impressions | ||
#### 2.1.10 - 2021-04-26 | ||
- Refactor variable declaration for attrName | ||
#### 2.1.9 - 2020-12-10 | ||
@@ -5,0 +8,0 @@ - Refactor variable declaration for attrName |
@@ -20,3 +20,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
moduleId = 6, | ||
version = '2.1.9', | ||
version = '2.1.10', | ||
MessageType = { | ||
@@ -221,11 +221,22 @@ SessionStart: 1, | ||
function addEcommerceProductImpression(product) { | ||
ga(createCmd('ec:addImpression'), { | ||
function addEcommerceProductImpression(product, updatedProductDimentionAndMetrics) { | ||
var productAttrs = { | ||
id: product.Sku, | ||
name: product.Name, | ||
type: 'view', | ||
category: product.Category, | ||
brand: product.Brand, | ||
variant: product.Variant | ||
}); | ||
variant: product.Variant, | ||
price: product.Price, | ||
coupon: product.CouponCode, | ||
quantity: product.Quantity, | ||
type: 'view' | ||
}; | ||
for (var attr in updatedProductDimentionAndMetrics) { | ||
if (updatedProductDimentionAndMetrics.hasOwnProperty(attr)) { | ||
productAttrs[attr] = updatedProductDimentionAndMetrics[attr]; | ||
} | ||
} | ||
ga(createCmd('ec:addImpression'), productAttrs); | ||
} | ||
@@ -252,3 +263,5 @@ | ||
impression.ProductList.forEach(function(product) { | ||
addEcommerceProductImpression(product); | ||
var updatedProductDimentionAndMetrics = {}; | ||
applyCustomDimensionsMetricsForSourceAttributes(product.Attributes, updatedProductDimentionAndMetrics, productLevelMap); | ||
addEcommerceProductImpression(product, updatedProductDimentionAndMetrics); | ||
}); | ||
@@ -493,3 +506,2 @@ }); | ||
} else { | ||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
@@ -564,3 +576,3 @@ } | ||
isInitialized = true; | ||
if (window.mParticle.getVersion().split('.')[0] === '2') { | ||
@@ -635,3 +647,3 @@ onUserIdentified(mParticle.Identity.getCurrentUser()); | ||
if (!config) { | ||
window.console.log('You must pass a config object to register the kit ' + name); | ||
console.log('You must pass a config object to register the kit ' + name); | ||
return; | ||
@@ -641,3 +653,3 @@ } | ||
if (!isObject(config)) { | ||
window.console.log('\'config\' must be an object. You passed in a ' + typeof config); | ||
console.log('\'config\' must be an object. You passed in a ' + typeof config); | ||
return; | ||
@@ -656,11 +668,13 @@ } | ||
} | ||
window.console.log('Successfully registered ' + name + ' to your mParticle configuration'); | ||
console.log('Successfully registered ' + name + ' to your mParticle configuration'); | ||
} | ||
if (window && window.mParticle && window.mParticle.addForwarder) { | ||
window.mParticle.addForwarder({ | ||
name: name, | ||
constructor: constructor, | ||
getId: getId | ||
}); | ||
if (typeof window !== 'undefined') { | ||
if (window && window.mParticle && window.mParticle.addForwarder) { | ||
window.mParticle.addForwarder({ | ||
name: name, | ||
constructor: constructor, | ||
getId: getId | ||
}); | ||
} | ||
} | ||
@@ -667,0 +681,0 @@ |
{ | ||
"name": "@mparticle/web-google-analytics-kit", | ||
"version": "2.1.9", | ||
"version": "2.1.10", | ||
"author": "mParticle Developers <developers@mparticle.com> (https://www.mparticle.com)", | ||
@@ -5,0 +5,0 @@ "description": "mParticle integration sdk for Google Analytics", |
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
34988
591