From 68b943a33d252b575c4ea72563b9af8f306258d5 Mon Sep 17 00:00:00 2001 From: Samuel Dobbie Date: Thu, 2 Dec 2021 14:20:15 +0000 Subject: [PATCH] Handle consent case where GDPR doesn't apply (#7783) --- modules/glimpseBidAdapter.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/glimpseBidAdapter.js b/modules/glimpseBidAdapter.js index 7bcf8cf3a7d..7ee3717a84b 100644 --- a/modules/glimpseBidAdapter.js +++ b/modules/glimpseBidAdapter.js @@ -142,11 +142,12 @@ function getGdprConsentChoice(bidderRequest) { if (hasGdprConsent) { const gdprConsent = bidderRequest.gdprConsent + const hasGdprApplies = hasBooleanValue(gdprConsent.gdprApplies) return { consentString: gdprConsent.consentString || '', vendorData: gdprConsent.vendorData || {}, - gdprApplies: gdprConsent.gdprApplies || true, + gdprApplies: hasGdprApplies ? gdprConsent.gdprApplies : true, } } @@ -182,6 +183,13 @@ function hasValue(value) { ) } +function hasBooleanValue(value) { + return ( + hasValue(value) && + typeof value === 'boolean' + ) +} + function hasStringValue(value) { return ( hasValue(value) &&