package analytics import "strings" // botMarkers is the vendored user-agent list (spec ยง3.3): incomplete by // nature, so the tab shows the bots count rather than pretending. Matched // case-insensitively as substrings. An empty UA is a bot: no browser sends // none. var botMarkers = []string{ "bot", "crawler", "spider", "slurp", "curl/", "wget/", "python-requests", "go-http-client", "headlesschrome", "phantomjs", "facebookexternalhit", "ahrefs", "semrush", "mj12", "dotbot", "petalbot", "bytespider", "gptbot", "claudebot", "ccbot", "applebot", "yandex", "baiduspider", "duckduckbot", "linkedinbot", "twitterbot", "discordbot", "telegrambot", "whatsapp", "pingdom", "uptimerobot", "statuscake", "site24x7", "newrelicpinger", "lighthouse", "pagespeed", "gtmetrix", "httpclient", "okhttp", "java/", "libwww", "scrapy", "node-fetch", "axios/", "postmanruntime", "insomnia", } // IsBot reports whether ua looks like an automated client. func IsBot(ua string) bool { if ua == "" { return true } l := strings.ToLower(ua) for _, m := range botMarkers { if strings.Contains(l, m) { return true } } return false }