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.
This commit is contained in:
Usman Baig
2026-03-17 22:32:45 +01:00
parent fa9fa26a1f
commit 90944ce6bd

View File

@@ -320,7 +320,7 @@
url: location.href, url: location.href,
title: document.title, title: document.title,
referrer: document.referrer || '', 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(), session_id: getSessionId(),
name: eventName.trim().toLowerCase(), name: eventName.trim().toLowerCase(),
}; };