From 73fc47e9109da2b5ac9078ee289ba94e91011b78 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Thu, 19 Mar 2026 13:45:21 +0100 Subject: [PATCH] fix: support GTM and tag managers via window.pulseConfig fallback Script detection now also searches by src URL and supports a global config object (window.pulseConfig) for environments where data-* attributes are not preserved on the injected script element. --- lib/integration-guides.tsx | 21 ++++++++++++++++++-- public/script.js | 39 ++++++++++++++++++++++++++++---------- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/lib/integration-guides.tsx b/lib/integration-guides.tsx index 5cfaf17..dd175f7 100644 --- a/lib/integration-guides.tsx +++ b/lib/integration-guides.tsx @@ -2298,15 +2298,32 @@ export default defineConfig({

Follow these steps to add Pulse through GTM:

  1. Go to Tags → New → Custom HTML
  2. -
  3. Paste the Pulse script
  4. +
  5. Paste the snippet below (replace your-site.com with your domain)
  6. Set the trigger to All Pages
  7. Publish your container
- {` +`} + +

+ This uses a global config object so that GTM does not need to preserve{' '} + data-* attributes on the injected script element. You can + also pass api, storage, and other options via{' '} + pulseConfig. +

+ +
+ + Alternative: inline data attributes (may not work in all GTM setups) + + {``} +

For more details, see the{' '} diff --git a/public/script.js b/public/script.js index 34f078a..1a15f6d 100644 --- a/public/script.js +++ b/public/script.js @@ -19,18 +19,37 @@ } - // * Get domain from script tag - const script = document.currentScript || document.querySelector('script[data-domain]'); - if (!script || !script.getAttribute('data-domain')) { + // * Get config from script tag, or fall back to window.pulseConfig for GTM / tag managers + // * GTM Custom HTML tags may not preserve data-* attributes on the injected