Pass data-host-url to Umami script for cross-origin collect endpoint

This commit is contained in:
dmitry.galkin 2026-05-25 17:29:04 +04:00
parent 22a172e92d
commit d3e3625375

View file

@ -8,9 +8,17 @@ export function Analytics() {
return null; return null;
} }
let hostUrl: string | undefined;
try {
hostUrl = new URL(scriptUrl).origin;
} catch {
hostUrl = undefined;
}
return ( return (
<Script <Script
async async
data-host-url={hostUrl}
data-website-id={websiteId} data-website-id={websiteId}
defer defer
src={scriptUrl} src={scriptUrl}