From e2e811076e65fe8b70972205c630e2095089e749 Mon Sep 17 00:00:00 2001 From: Gaurav Kochar Date: Tue, 4 Apr 2023 15:05:18 +0530 Subject: [PATCH 1/4] added total key --- integrations/klaviyo/lib/index.js | 3 ++- integrations/klaviyo/test/index.test.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/integrations/klaviyo/lib/index.js b/integrations/klaviyo/lib/index.js index 33b60bb21..94754a3cb 100644 --- a/integrations/klaviyo/lib/index.js +++ b/integrations/klaviyo/lib/index.js @@ -132,7 +132,8 @@ Klaviyo.prototype.orderCompleted = function(track) { $value: track.revenue(), Categories: products.categories, ItemNames: products.names, - Items: products.items + Items: products.items, + total: track.total() }; var whitelist = [ diff --git a/integrations/klaviyo/test/index.test.js b/integrations/klaviyo/test/index.test.js index c51239fcc..4c2d080ed 100644 --- a/integrations/klaviyo/test/index.test.js +++ b/integrations/klaviyo/test/index.test.js @@ -228,6 +228,7 @@ describe('Klaviyo', function() { $value: 25, Categories: ['Games', 'Interwebs'], ItemNames: ['Monopoly: 3rd Edition', 'Suh dude'], + total: 30, Items: [ { id: '507f1f77bcf86cd799439011', @@ -291,6 +292,7 @@ describe('Klaviyo', function() { $value: 25, Categories: ['Games'], ItemNames: ['Monopoly: 3rd Edition'], + total: 30, Items: [ { id: '507f1f77bcf86cd799439011', @@ -452,6 +454,7 @@ describe('Klaviyo', function() { $value: 25, Categories: ['Games', 'Interwebs'], ItemNames: ['Monopoly: 3rd Edition', 'Suh dude'], + total: 30, Items: [ { id: '507f1f77bcf86cd799439011', From 2df8953357fcaac28aaadb3b23e864160495a342 Mon Sep 17 00:00:00 2001 From: Gaurav Kochar Date: Thu, 6 Apr 2023 14:08:20 +0530 Subject: [PATCH 2/4] updated klaviyo version --- integrations/klaviyo/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/klaviyo/package.json b/integrations/klaviyo/package.json index a086b0109..9944f180f 100644 --- a/integrations/klaviyo/package.json +++ b/integrations/klaviyo/package.json @@ -1,7 +1,7 @@ { "name": "@segment/analytics.js-integration-klaviyo", "description": "The Klaviyo analytics.js integration.", - "version": "2.2.5", + "version": "2.2.6", "keywords": [ "analytics.js", "analytics.js-integration", From f346c56ffca2db9ab34fa230d0404c486f2ab3ad Mon Sep 17 00:00:00 2001 From: Gaurav Kochar Date: Mon, 10 Apr 2023 12:21:15 +0530 Subject: [PATCH 3/4] removed total from whitelist --- integrations/klaviyo/lib/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/integrations/klaviyo/lib/index.js b/integrations/klaviyo/lib/index.js index 94754a3cb..88b09e543 100644 --- a/integrations/klaviyo/lib/index.js +++ b/integrations/klaviyo/lib/index.js @@ -132,8 +132,7 @@ Klaviyo.prototype.orderCompleted = function(track) { $value: track.revenue(), Categories: products.categories, ItemNames: products.names, - Items: products.items, - total: track.total() + Items: products.items }; var whitelist = [ @@ -145,7 +144,6 @@ Klaviyo.prototype.orderCompleted = function(track) { 'itemNames', 'items', 'revenue', - 'total', 'products' ]; // strip standard props and leave custom props only From 370afd3a2519ce5a0e06f292cfe25fa409ba3035 Mon Sep 17 00:00:00 2001 From: Gaurav Kochar Date: Tue, 11 Apr 2023 14:23:48 +0530 Subject: [PATCH 4/4] test case if revenue missing --- integrations/klaviyo/test/index.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/integrations/klaviyo/test/index.test.js b/integrations/klaviyo/test/index.test.js index 4c2d080ed..7b07cd23d 100644 --- a/integrations/klaviyo/test/index.test.js +++ b/integrations/klaviyo/test/index.test.js @@ -416,7 +416,6 @@ describe('Klaviyo', function() { letMePass: 'hi', customProp: true, total: 30, - revenue: 25, shipping: 3, tax: 2, discount: 2.5, @@ -451,7 +450,7 @@ describe('Klaviyo', function() { 'Completed Order', { $event_id: '50314b8e9bcf000000000000', - $value: 25, + $value: 30, Categories: ['Games', 'Interwebs'], ItemNames: ['Monopoly: 3rd Edition', 'Suh dude'], total: 30,