What does adding Traceten to Next.js give you?
One Script tag in your root layout shows which AI assistants send visitors to your Next.js app, with every route change counted automatically. Add the Traceten middleware to your proxy file too, and the AI crawlers that fetch your pages show up beside the visits. The snippet stays under 10 KB gzipped.
What will you see in Traceten?
- AI referral visits
- Visits from 25+ AI assistants, named from the referrer, UTM tags and user agent.
- Confidence and method
- Every visit carries a confidence score from 0 to 1 and the method that named its source.
- Client-side navigations
- App Router and Pages Router route changes each count as a page view, with no code from you.
- AI crawler hits
- With the middleware in your proxy file, GPTBot, ClaudeBot and the rest are logged from your server.
- Engagement per page
- Scroll depth and active time for each page view, so you can see whether AI visitors read.
How do you install Traceten on Next.js?
- 01
Copy your tag
Open Sites, then Install, in the dashboard and copy the tag. It already carries your site key.
- 02
Add it to your root layout
In app/layout.tsx, render it with next/script and strategy="afterInteractive". On the Pages Router, use pages/_document.tsx.
- 03
Deploy and verify
Deploy, open your site, and watch the Verify step on the install page turn green.
Questions
01Do I need to track Next.js route changes myself?
No. The snippet watches history changes and back or forward navigation, so App Router and Pages Router routes are counted once. Firing a pageview yourself as well double-counts.
02Does the Traceten snippet slow down a Next.js app?
It loads after hydration and defers its work until the browser is idle. CI fails any build of the snippet over 10 KB gzipped.
03Can Traceten see AI crawlers on a Next.js site?
Yes, with the Traceten middleware in your proxy file. Crawlers run no JavaScript, so the snippet alone never sees them.
04Can I use separate site keys for staging and production?
Yes. Read the key from an environment variable such as NEXT_PUBLIC_TRACETEN_SITE_KEY and render the Script only when it is set.
AI is already sending you buyers. See the receipts.
No calls, no credit card.

