diff --git a/lib/integration-guides.tsx b/lib/integration-guides.tsx index dd175f7..b8bfa83 100644 --- a/lib/integration-guides.tsx +++ b/lib/integration-guides.tsx @@ -2298,31 +2298,30 @@ export default defineConfig({
Follow these steps to add Pulse through GTM:
your-site.com with your domain)
- 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.
+ That's it. Pulse auto-detects the domain from the page, so no extra
+ configuration is needed.
+ If your site is registered under a different domain than the page
+ hostname, or you need custom options (API endpoint, storage mode, etc.),
+ use pulseConfig:
+
diff --git a/public/script.js b/public/script.js index 1a15f6d..12c076d 100644 --- a/public/script.js +++ b/public/script.js @@ -40,7 +40,10 @@ return (script && script.hasAttribute('data-' + name)) || globalConfig[name] === true || globalConfig[camel] === true; } - const domain = attr('domain'); + // * Resolve domain: explicit config > data-domain > auto-detect from hostname + // * Auto-detect enables zero-config GTM installs; the backend validates Origin anyway + var explicitDomain = attr('domain'); + const domain = explicitDomain || location.hostname.replace(/^www\./, ''); if (!domain) { return; }