From e6780179c30f4d9a2f76b693044e70058b3a77c3 Mon Sep 17 00:00:00 2001 From: Jeff Foxx <88052587+jfoxx@users.noreply.github.com> Date: Thu, 2 Apr 2026 16:01:27 -0400 Subject: [PATCH] Add check for empty content in options If an activity is active on the page, but the audience is not met, Target returns an empty array for the offers. This prevents that from bombing the rest of the page. --- scripts/scripts.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/scripts.js b/scripts/scripts.js index 4b55e41..5737ca9 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -50,6 +50,7 @@ async function loadTarget() { // Loop through them and inject offers?.execute?.pageLoad?.options?.forEach((opt) => { + if (!opt.content?.[0] || opt.content.length === 0) return; const { cssSelector, content } = opt.content[0]; const el = document.querySelector(cssSelector); if (el) el.outerHTML = content;