From 2202dd9493b69a2387922321473ab7ca591620ae Mon Sep 17 00:00:00 2001 From: Alexander Sapountzis Date: Thu, 22 Feb 2024 13:54:56 -0500 Subject: [PATCH] Address PR Comments --- src/GoogleAdWordsEventForwarder.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/GoogleAdWordsEventForwarder.js b/src/GoogleAdWordsEventForwarder.js index e031d7a..e715573 100644 --- a/src/GoogleAdWordsEventForwarder.js +++ b/src/GoogleAdWordsEventForwarder.js @@ -33,6 +33,7 @@ // Server Integration uses 'Unspecified' as a value when the setting is 'not set'. // However, this is not used by Google's Web SDK. We are referencing it here as a comment // as a record of this distinction and for posterity. + // If Google ever adds this for web, the line can just be uncommented to support this. // // Docs: // Web: https://developers.google.com/tag-platform/gtagjs/reference#consent @@ -93,15 +94,14 @@ var updatedConsentPayload = generateConsentStatePayloadFromMappings( eventConsentState, consentMappings, - consentPayloadDefaults, ); - var eventPayloadAsString = + var eventConsentAsString = JSON.stringify(updatedConsentPayload); - if (eventPayloadAsString !== consentPayloadAsString) { + if (eventConsentAsString !== consentPayloadAsString) { sendGtagConsentUpdate(updatedConsentPayload); - consentPayloadAsString = eventPayloadAsString; + consentPayloadAsString = eventConsentAsString; } } @@ -396,7 +396,7 @@ if ( consentState[mpMappedConsentName] && - googleConsentProperties.includes(googleMappedConsentName) + googleConsentProperties.indexOf(googleMappedConsentName) !== -1 ) { payload[googleMappedConsentName] = consentState[mpMappedConsentName] .Consented @@ -549,7 +549,6 @@ generateConsentStatePayloadFromMappings( initialConsentState, consentMappings, - consentPayloadDefaults, ); consentPayloadAsString = JSON.stringify(defaultConsentPayload);