Skip to content

detectAiAgent

reference
1 min readUpdated

Kind: Function

Source: atloria-monorepo/apps/api/src/events/agent-detect.ts

Classify a User-Agent for agent-read recording.

  • Known AI bot → its normalized vendor name.
  • Empty / scripted UA → 'Other bot' (record it — it's not a human).
  • Real browser → null (don't record; that's page-view analytics).
  • Anything else unknown → 'Other bot' (better to log than to lose the signal).

Signature

ts
function detectAiAgent(userAgent: string | null): string | null

Parameters

NameType
userAgent`string

Returns: string | null

Was this page helpful?

Download as PDF