From ffd29c1576d5ef244f31f042c5c486bdd02c8d0f Mon Sep 17 00:00:00 2001 From: bosco-ensemble Date: Wed, 17 Apr 2024 12:35:07 -0700 Subject: [PATCH] TDW-2409 changed conditional statement --- blocks/marketing/marketing.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/blocks/marketing/marketing.js b/blocks/marketing/marketing.js index ca5116f..1ecd2f2 100644 --- a/blocks/marketing/marketing.js +++ b/blocks/marketing/marketing.js @@ -81,22 +81,18 @@ export default async function decorate(block) { document.addEventListener('scroll', checkBottomAdDisplay); } } else { - window.tude.setFeatureFlags({ injectAds: false }); + window.tude.setFeatureFlags({injectAds: false}); const adTest = new URLSearchParams(window.location.search).get('ad_test'); - if (adTest) { - window.tude.refreshAdsViaDivMappings([{ - divId: slot, - baseDivId: slot, - targeting: { - ad_test: adTest, - }, - }]); - } else { - window.tude.refreshAdsViaDivMappings([{ - divId: slot, - baseDivId: slot, - }]); + const adMapping = { + divId: slot, + baseDivId: slot, } + if (adTest) adMapping.targeting = { + ad_test: adTest, + } + window.tude.refreshAdsViaDivMappings([ + adMapping + ]); } }); });