@mparticle/web-google-analytics-kit
Advanced tools
Comparing version 2.1.10 to 2.1.11
## Releases | ||
- fix: Set custom dimensions for product impressions | ||
#### 2.1.11 - 2021-05-13 | ||
- Send product impression list name | ||
- Implement hashUserId and externalUserIdentityType settings | ||
#### 2.1.10 - 2021-04-26 | ||
- Refactor variable declaration for attrName | ||
- Fix - Set custom dimensions for product impressions | ||
@@ -7,0 +10,0 @@ #### 2.1.9 - 2020-12-10 |
@@ -20,3 +20,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
moduleId = 6, | ||
version = '2.1.10', | ||
version = '2.1.11', | ||
MessageType = { | ||
@@ -32,2 +32,17 @@ SessionStart: 1, | ||
trackerCount = 1, | ||
externalUserIdentityType = { | ||
none: 'None', | ||
customerId: "CustomerId", | ||
other: "Other", | ||
other2: "Other2", | ||
other3: "Other3", | ||
other4: "Other4", | ||
other5: "Other5", | ||
other6: "Other6", | ||
other7: "Other7", | ||
other8: "Other8", | ||
other9: "Other9", | ||
other10: "Other10", | ||
}, | ||
NON_INTERACTION_FLAG = 'Google.NonInteraction', | ||
@@ -177,3 +192,3 @@ CATEGORY = 'Google.Category', | ||
if (isInitialized) { | ||
if (forwarderSettings.useCustomerId == 'True' && type == window.mParticle.IdentityType.CustomerId) { | ||
if (forwarderSettings.hashUserId == 'True' && type == window.mParticle.IdentityType.CustomerId) { | ||
if (forwarderSettings.classicMode == 'True') ; | ||
@@ -191,10 +206,63 @@ else { | ||
function generateHash(id) { | ||
return window.mParticle.generateHash(id); | ||
} | ||
function onUserIdentified(user) { | ||
var userIdentities = user.getUserIdentities().userIdentities; | ||
if (!user) { | ||
return; | ||
} | ||
var userId, | ||
userIdentities = user.getUserIdentities().userIdentities; | ||
if (isInitialized) { | ||
if (forwarderSettings.useCustomerId == 'True' && userIdentities.customerid) { | ||
if (forwarderSettings.externalUserIdentityType !== externalUserIdentityType.none) { | ||
switch (forwarderSettings.externalUserIdentityType) { | ||
case "CustomerId": | ||
userId = userIdentities.customerid; | ||
break; | ||
case "Other": | ||
userId = userIdentities.other; | ||
break; | ||
case "Other2": | ||
userId = userIdentities.other2; | ||
break; | ||
case "Other3": | ||
userId = userIdentities.other3; | ||
break; | ||
case "Other4": | ||
userId = userIdentities.other4; | ||
break; | ||
case "Other5": | ||
userId = userIdentities.other5; | ||
break; | ||
case "Other6": | ||
userId = userIdentities.other6; | ||
break; | ||
case "Other7": | ||
userId = userIdentities.other7; | ||
break; | ||
case "Other8": | ||
userId = userIdentities.other8; | ||
break; | ||
case "Other9": | ||
userId = userIdentities.other9; | ||
break; | ||
case "Other10": | ||
userId = userIdentities.other10; | ||
break; | ||
default: | ||
console.warn('External identity type not found for setting identity on ' + name + '. User not set. Please double check your implementation.'); | ||
} | ||
} | ||
if (userId) { | ||
if (forwarderSettings.hashUserId == 'True') { | ||
userId = generateHash(userId); | ||
} | ||
if (forwarderSettings.classicMode !== 'True') { | ||
ga(createCmd('set'), 'userId', window.mParticle.generateHash(userIdentities.customerid)); | ||
ga(createCmd('set'), 'userId', userId); | ||
} | ||
} else { | ||
console.warn('External identity type of ' + forwarderSettings.externalUserIdentityType + ' not set on the user'); | ||
} | ||
} | ||
@@ -224,3 +292,3 @@ } | ||
function addEcommerceProductImpression(product, updatedProductDimentionAndMetrics) { | ||
function addEcommerceProductImpression(product, impressionListName, updatedProductDimentionAndMetrics) { | ||
var productAttrs = { | ||
@@ -235,2 +303,3 @@ id: product.Sku, | ||
quantity: product.Quantity, | ||
list: impressionListName, | ||
type: 'view' | ||
@@ -266,6 +335,7 @@ }; | ||
event.ProductImpressions.forEach(function(impression) { | ||
var impressionListName = impression.ProductImpressionList; | ||
impression.ProductList.forEach(function(product) { | ||
var updatedProductDimentionAndMetrics = {}; | ||
applyCustomDimensionsMetricsForSourceAttributes(product.Attributes, updatedProductDimentionAndMetrics, productLevelMap); | ||
addEcommerceProductImpression(product, updatedProductDimentionAndMetrics); | ||
addEcommerceProductImpression(product, impressionListName, updatedProductDimentionAndMetrics); | ||
}); | ||
@@ -272,0 +342,0 @@ }); |
{ | ||
"name": "@mparticle/web-google-analytics-kit", | ||
"version": "2.1.10", | ||
"version": "2.1.11", | ||
"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
37935
658