From d97818dfd7377bab6d8de120f9349aa802b97923 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Tue, 17 Mar 2026 22:32:45 +0100 Subject: [PATCH] fix: use screen.width fallback in trackCustomEvent to prevent bot filter false positives window.innerWidth is 0 in hidden/minimized tabs, causing the heuristic bot scorer (added in #40) to drop legitimate custom events with a score of 5. Use window.screen.width as fallback, matching the existing trackPageview logic. --- public/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 21632f6..34f078a 100644 --- a/public/script.js +++ b/public/script.js @@ -320,7 +320,7 @@ url: location.href, title: document.title, referrer: document.referrer || '', - screen: { width: window.innerWidth || 0, height: window.innerHeight || 0 }, + screen: { width: window.innerWidth || window.screen.width, height: window.innerHeight || window.screen.height }, session_id: getSessionId(), name: eventName.trim().toLowerCase(), };