fix: auto-detect domain from hostname for zero-config GTM support #65

Merged
uz1mani merged 2 commits from staging into main 2026-03-19 12:59:05 +00:00
Showing only changes of commit ac9e10b436 - Show all commits

View File

@@ -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;
}