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
1 changed files with 5 additions and 2 deletions

View File

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