Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Added check for bots.
Mike Cao943c2c73d476
diff --git a/package.json b/package.jsonindex b8ff901c5..71f90cae6 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "umami",- "version": "0.26.0",+ "version": "0.27.0","description": "A simple, fast, website analytics alternative to Google Analytics. ","author": "Mike Cao <[email protected]>","license": "MIT",@@ -59,6 +59,7 @@"geolite2-redist": "^1.0.7","immer": "^7.0.8","is-localhost-ip": "^1.4.0",+ "isbot-fast": "^1.2.0","jose": "^1.28.0","maxmind": "^4.1.4","moment-timezone": "^0.5.31",diff --git a/pages/api/collect.js b/pages/api/collect.jsindex 56d2ea79f..399e88e96 100644--- a/pages/api/collect.js+++ b/pages/api/collect.js@@ -1,8 +1,13 @@import { savePageView, saveEvent } from 'lib/queries';import { useCors, useSession } from 'lib/middleware';import { ok, badRequest } from 'lib/response';+import isBot from 'isbot-fast';export default async (req, res) => {+ if (isBot(req.headers['user-agent'])) {+ return ok(res);+ }+await useCors(req, res);await useSession(req, res);diff --git a/yarn.lock b/yarn.lockindex 52c57c7e1..7e0a5f749 100644--- a/yarn.lock+++ b/yarn.lock@@ -4965,6 +4965,11 @@ [email protected], isarray@^1.0.0, isarray@~1.0.0:resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=+isbot-fast@^1.2.0:+ version "1.2.0"+ resolved "https://registry.yarnpkg.com/isbot-fast/-/isbot-fast-1.2.0.tgz#ef0ef1d5db34eb60777250ae26fceb72b94153e2"+ integrity sha512-twjuQzy2gKMDVfKGQyQqrx6Uy4opu/fiVUTTpdqtFsd7OQijIp5oXvb27n5EemYXaijh5fomndJt/SPRLsEdSg==+isexe@^2.0.0:version "2.0.0"resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"