feat: filter headless browsers and zero-screen bots client-side

This commit is contained in:
Usman Baig
2026-03-13 09:07:49 +01:00
parent f69248ecfa
commit 6e213539ea
2 changed files with 11 additions and 0 deletions

View File

@@ -13,6 +13,11 @@
return;
}
// * Skip headless browsers and automated tools (Puppeteer, Playwright, Selenium)
if (navigator.webdriver) {
return;
}
// * Get domain from script tag
const script = document.currentScript || document.querySelector('script[data-domain]');
if (!script || !script.getAttribute('data-domain')) {
@@ -321,6 +326,11 @@
height: window.innerHeight || window.screen.height,
};
// * Skip bots with no screen dimensions (0x0)
if (screenSize.width === 0 && screenSize.height === 0) {
return;
}
const payload = {
domain: domain,
path: path,