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:
@@ -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(),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user