From 179d468d88428ba1bbea41a256be4e67a178c859 Mon Sep 17 00:00:00 2001 From: Gabriel P Samson Date: Fri, 26 Jun 2020 13:27:05 -0700 Subject: [PATCH 1/3] Stringify context vals of type bool --- integrations/adobe-analytics/lib/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/integrations/adobe-analytics/lib/index.js b/integrations/adobe-analytics/lib/index.js index 84073d524..381fba326 100644 --- a/integrations/adobe-analytics/lib/index.js +++ b/integrations/adobe-analytics/lib/index.js @@ -620,6 +620,13 @@ function updateContextData(facade, options) { return; } + // If context data values are booleans then stringify them. + // Adobe's SDK seems to reject a false boolean value. Stringifying is + // acceptable since these values are appended as query strings anyway. + if (typeof value === 'boolean') { + value = value.toString(); + } + addContextDatum(key, value); }, contextProperties); } From a86d1e844d5bf19af972b9640171df110b93c54c Mon Sep 17 00:00:00 2001 From: Gabriel P Samson Date: Fri, 26 Jun 2020 14:15:50 -0700 Subject: [PATCH 2/3] Add tests --- .../adobe-analytics/test/index.test.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/integrations/adobe-analytics/test/index.test.js b/integrations/adobe-analytics/test/index.test.js index d1c3fdb23..73e2b1628 100644 --- a/integrations/adobe-analytics/test/index.test.js +++ b/integrations/adobe-analytics/test/index.test.js @@ -1175,6 +1175,30 @@ describe('Adobe Analytics', function() { }); analytics.equal(window.s.events, 'prodView,event1,event38'); }); + + it('should stringify bool context data', function() { + adobeAnalytics.options.contextValues = { + 'page.referrer': 'page.referrer', + 'page.url': 'page.title', + 'page.bickenBack': 'page.bickenBack' + }; + analytics.track( + 'Drank Some Milk', + { foo: 'bar' }, + { page: { bickenBack: false } } + ); + analytics.equal( + window.s.contextData['page.referrer'], + window.document.referrer + ); + analytics.equal( + window.s.contextData['page.title'], + window.location.href + ); + analytics.equal(window.s.contextData['page.bickenBack'], 'false'); + analytics.equal(window.s.contextData.foo, 'bar'); + analytics.called(window.s.tl); + }); }); }); From e7c54e7cca775c444445890dfa24890c24bd0e28 Mon Sep 17 00:00:00 2001 From: Gabriel P Samson Date: Fri, 26 Jun 2020 14:28:45 -0700 Subject: [PATCH 3/3] LINT --- integrations/adobe-analytics/lib/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/integrations/adobe-analytics/lib/index.js b/integrations/adobe-analytics/lib/index.js index 381fba326..d5a275263 100644 --- a/integrations/adobe-analytics/lib/index.js +++ b/integrations/adobe-analytics/lib/index.js @@ -624,7 +624,8 @@ function updateContextData(facade, options) { // Adobe's SDK seems to reject a false boolean value. Stringifying is // acceptable since these values are appended as query strings anyway. if (typeof value === 'boolean') { - value = value.toString(); + addContextDatum(key, value.toString()); + return; } addContextDatum(key, value);