diff --git a/src/commerce-handler.js b/src/commerce-handler.js index a449637..1b4bdd6 100644 --- a/src/commerce-handler.js +++ b/src/commerce-handler.js @@ -202,7 +202,7 @@ function buildProductActionEvents(event) { if (!event.ProductAction) { actionEventName = HeapConstants.EventNameProductAction; } else { - var productActionKey = event.ProductAction.ProductActionType; + var productActionKey = ProductActionNames[event.ProductAction.ProductActionType]; actionEventName = HeapConstants.EventNameProductActionPart + productActionKey; } @@ -277,12 +277,10 @@ function buildPromotionItemEvent(promotion) { var key = validatedPromotionKeys[i]; var value = validatedPromotionValues[key]; - if (value === undefined || key === undefined) { - return; + if (value && key) { + var constKey = HeapConstants[key]; + properties[constKey] = value; } - - var constKey = HeapConstants[key]; - properties[constKey] = value; } event.Name = HeapConstants.EventNameItem; event.Properties = properties; diff --git a/test/end-to-end-testapp/settings.js b/test/end-to-end-testapp/settings.js index c709c37..7d3c045 100644 --- a/test/end-to-end-testapp/settings.js +++ b/test/end-to-end-testapp/settings.js @@ -4,7 +4,7 @@ var SDKsettings = { initialize, this may be apiKey, projectId, primaryCustomerType, etc. These are passed into the src/initialization.js file as the */ - appId: 'testAppId', + applicationId: 'testAppId', userIdentificationType: 'customerid', forwardWebRequestsServerSide: false, }; diff --git a/test/src/tests.js b/test/src/tests.js index 66f970e..9eb748a 100644 --- a/test/src/tests.js +++ b/test/src/tests.js @@ -440,6 +440,7 @@ describe('Heap Forwarder', function () { if (eventName.includes('Action')) { properties.skus.length.should.equal(2); + eventName.includes('Purchase').should.be.ok; } } @@ -500,6 +501,7 @@ describe('Heap Forwarder', function () { if (eventName.includes('Promotion')) { properties.skus.length.should.equal(2); + eventName.includes('Click').should.be.ok; } } done();