Analytics: Ereignisse annehmen
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cd9aebe4b1
commit
3a48e6e677
6 files changed
+472
-4
No files matched your search
@@ -0,0 +1,10 @@
|
||||
// Gröbste Bot- und Gerätetyp-Erkennung; der User-Agent wird danach verworfen.
|
||||
const BOT = /bot|crawl|spider|slurp|headless|lighthouse|pingdom|uptime|curl|wget|python|go-http|java\/|facebookexternalhit|preview/i;
|
||||
|
||||
export function classifyUa(ua) {
|
||||
const s = typeof ua === 'string' ? ua : '';
|
||||
if (!s || BOT.test(s)) return { bot: true, device: 'd' };
|
||||
if (/Mobi|Android.*Mobile|iPhone/i.test(s)) return { bot: false, device: 'm' };
|
||||
if (/iPad|Tablet|Android(?!.*Mobile)/i.test(s)) return { bot: false, device: 't' };
|
||||
return { bot: false, device: 'd' };
|
||||
}
|
||||
Reference in new issue
Block a user