extract longer shorthost when dealing with doubleclick to distinguish

stats from ads
This commit is contained in:
Kuba Orlik 2021-11-24 23:58:12 +01:00
parent 8d88ba7506
commit 7527288d95

View File

@ -36,8 +36,11 @@ export function getshorthost(host: string) {
.replace(/^.*:\/\//, "") .replace(/^.*:\/\//, "")
.replace(/\/.*$/, "") .replace(/\/.*$/, "")
.split("."); .split(".");
let lookback = parts.at(-2).length > 3 ? -2 : -3;
return parts.slice(parts.at(-2).length > 3 ? -2 : -3).join("."); if (parts.at(-2) == "doubleclick") {
lookback = -4; // to distinguish between google ads and stats
}
return parts.slice(lookback).join(".");
} }
export function useEmitter( export function useEmitter(