Pass data-host-url to Umami script for cross-origin collect endpoint
This commit is contained in:
parent
22a172e92d
commit
d3e3625375
1 changed files with 8 additions and 0 deletions
|
|
@ -8,9 +8,17 @@ export function Analytics() {
|
|||
return null;
|
||||
}
|
||||
|
||||
let hostUrl: string | undefined;
|
||||
try {
|
||||
hostUrl = new URL(scriptUrl).origin;
|
||||
} catch {
|
||||
hostUrl = undefined;
|
||||
}
|
||||
|
||||
return (
|
||||
<Script
|
||||
async
|
||||
data-host-url={hostUrl}
|
||||
data-website-id={websiteId}
|
||||
defer
|
||||
src={scriptUrl}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue