mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 07:13:37 +01:00
Generic AIP collect URL allowing subfolders
I've changed the fetching of "hostUrl" variable to match not only domain, but the subfolder as well. The thing is I've installed the analytics to subfolder "/myfolder/" but when I used the code, the tracker tries to send the data to "mydomain.com/api/collect" instead of correct "mydomain.com/myfolder/api/collect". This change fixes the issue. It's not pretty to filter out the name of the script from the path by .replace, but I wasn't able to find better solution to get the subfolder. If you do, please change it :)
This commit is contained in:
parent
3e1bc27f26
commit
4fb9150631
@ -17,7 +17,7 @@ import { post, hook, doNotTrack } from '../lib/web';
|
||||
if (!script || (__DNT__ && doNotTrack())) return;
|
||||
|
||||
const website = script.getAttribute('data-website-id');
|
||||
const hostUrl = new URL(script.src).origin;
|
||||
const hostUrl = new URL(script.src).href.replace(/\/umami\.js$/,'');
|
||||
const screen = `${width}x${height}`;
|
||||
const listeners = [];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user