Repository navigation
feat(edge): add visit-analytics user-agent parser and range table - #1064
Closed
Brooooooklyn wants to merge 2 commits into
Closed
Brooooooklyn wants to merge 2 commits into
Brooooooklyn wants to merge 2 commits into
Conversation
Add `@void/edge/visit-analytics`, a small pure module the platform will use for visit analytics: - parseUserAgent(ua, secChUaMobile?, secChUa?) returns device, browser, bot label and bot group (ai/search/social/seo/monitor/tool/other). It lowercases once and checks ordered token lists with includes(); the first match wins. No regex, no new dependency. - VISIT_RANGES (24h, 7d, 30d, 90d hosted-only) and isVisitRangeId(). - botGroupName() friendly group names for the dashboard and CLI. The module is its own pack entry and subpath export, so the dispatch worker can import it without the routing and static-asset runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… archive.org_bot - Node's built-in fetch() sends `User-Agent: node`; match that whole UA as a `tool` (not with includes(), so device names containing "node" stay human). - Chrome-Lighthouse (PageSpeed Insights) is a tool, not a Chrome view. - Cloudflare-Healthchecks is a monitor, so dispatch drops it as a probe. - archive.org_bot gets a named token; the generic label cut it at the dot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Cloudflare builds and deploys previews for this pull request. Learn more about Cloudflare previews.
Updated: |
This was referenced Dec 6, 2026
Member
Author
|
Combined into #1067 (visit analytics, one PR). All commits from this PR are on that branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First step of visit analytics. This adds a shared helper that later PRs use in dispatch, the platform API, the dashboard and the CLI. Nothing imports it yet.
What's new
@void/edge/visit-analytics(its own subpath, so dispatch doesn't pull in the routing runtime):includes(), and the first match wins.bot/Bot.monitorgroup (UptimeRobot, Pingdom, Cloudflare Health Checks, …) is the one dispatch will drop as a probe.fetch()UA (node) is matched as an exact string, so it counts as a tool, not a human.packages/edge/vite.config.tsadds the second pack entry.dist/index.mjsis unchanged in size, anddist/visit-analytics.mjs(about 10 kB) imports nothing.Tests
packages/edge/test/unit/visit-analytics.test.tshas 99 cases built from a table of real UAs: each AI and search bot, Edge vs Chrome vs Safari, CriOS, Samsung, Brave viaSec-CH-UA,Sec-CH-UA-Mobile: ?1, the Cubot phone (not a bot), empty UA, HeadlessChrome, Lighthouse and monitors.vp test run packages/edge/test/unit/visit-analytics.test.ts: 99/99vp check: cleanvp run test: 200/200 tasks🤖 Generated with Claude Code