upstash/agent-analytics

AI agent traffic analytics for Next.js

TypeScript

33

17 commits

updated Jun 5, 2026

See the code

README

@upstash/agent-analytics

Track Claude, ChatGPT, Perplexity and other citations to your website.

AI Analytics Screenshot

Setup

Track a request in your Next.js middleware (now named proxy.ts):

// proxy.ts
import { NextResponse, type NextRequest } from "next/server"
import { AgentAnalytics } from "@upstash/agent-analytics"
import { redis } from "./redis"

const analytics = new AgentAnalytics({ redis })

export const proxy = async (request: NextRequest) => {
  await analytics.track(request)

  return NextResponse.next()
}

export const config = {
  matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
}

You can now see AI traffic in your Upstash dashboard under AI Tracking (three dot menu in the top).

upstash/agent-analytics

AI agent traffic analytics for Next.js

TypeScript

33

17 commits

updated Jun 5, 2026

See the code

README

@upstash/agent-analytics

Track Claude, ChatGPT, Perplexity and other citations to your website.

AI Analytics Screenshot

Setup

Track a request in your Next.js middleware (now named proxy.ts):

// proxy.ts
import { NextResponse, type NextRequest } from "next/server"
import { AgentAnalytics } from "@upstash/agent-analytics"
import { redis } from "./redis"

const analytics = new AgentAnalytics({ redis })

export const proxy = async (request: NextRequest) => {
  await analytics.track(request)

  return NextResponse.next()
}

export const config = {
  matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
}

You can now see AI traffic in your Upstash dashboard under AI Tracking (three dot menu in the top).

Project health

Latest release

0.1.3 · Jun 4, 2026

Releases this year

4

Significant stargazers

Tommy D. Rossi

1,152 followers · starred Jun 2026