Skip to content

upstash/agent-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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).

About

AI agent traffic analytics for Next.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors