From e3556fd247a04ae8825deff1f6b86fbe7834d76c Mon Sep 17 00:00:00 2001 From: Jon McClure Date: Fri, 22 Mar 2024 13:42:20 +0000 Subject: [PATCH] graphicId in graphics should be just the UID from graphics server --- src/components/AdSlot/adScripts/bootstrap.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/AdSlot/adScripts/bootstrap.ts b/src/components/AdSlot/adScripts/bootstrap.ts index 02612682..465816b9 100644 --- a/src/components/AdSlot/adScripts/bootstrap.ts +++ b/src/components/AdSlot/adScripts/bootstrap.ts @@ -67,9 +67,9 @@ export const loadBootstrap = () => { } // Use the URL path to create a unique ID for the page. - const graphicId = window.location.pathname - .replace(/^\/(.*)\/$/, '$1') - .replaceAll('/', '-'); + const graphicId = window.location.pathname.split('/') + // Get the first lowercase slug in the pathname, which is the graphic UID. + .filter(d => d.match(/[a-z0-1]+/) && d !== 'graphics')[0] || 'unknown-graphic'; window.googletag.pubads().setTargeting('template', 'graphics'); window.googletag.pubads().setTargeting('graphicId', graphicId); });