Integration · AI Bot + Referrer Tracker
Foglift Tracker
See which AI engines crawl your site and which ones send you human visitors. One npm install. Two-line middleware setup. Cookieless, no fingerprinting, no consent banner needed.
TL;DR
- What gets tracked: AI crawler User-Agents (GPTBot, ClaudeBot, PerplexityBot, Google-Extended, Amazonbot, Bytespider, CCBot) and AI engine Referer headers (ChatGPT, Claude, Perplexity, Gemini, Copilot, NotebookLM). Both signals, one install.
- What does not get tracked: Page content, cookies, query strings, IPs, browser fingerprints. Visits where neither the UA nor the Referer matches an AI source are silently ignored.
- Cost: Free on every paid tier and rate-limited on the Free plan. The npm package is free; tracker events count against your account quota.
Three ways to install
Pick the path that matches where your site runs. The SDK is the recommended path for any server framework. The Cloudflare Worker is the right answer if your domain already sits behind Cloudflare. The pixel is the lowest-friction path for static sites and no-code builders.
1. SDK (Next.js, Express, Node)
Install the package, pin the minor:
npm install @foglift/tracker@^1.2.0
Next.js (middleware.ts):
import { trackAITraffic } from "@foglift/tracker/nextjs";
export const middleware = trackAITraffic({
apiKey: process.env.FOGLIFT_API_KEY!,
});
export const config = {
matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
};Express:
import express from "express";
import { trackAITraffic } from "@foglift/tracker/express";
const app = express();
app.use(trackAITraffic({ apiKey: process.env.FOGLIFT_API_KEY! }));Plain Node (any framework):
import http from "node:http";
import { createAITrafficTracker } from "@foglift/tracker/node";
const tracker = createAITrafficTracker({ apiKey: process.env.FOGLIFT_API_KEY! });
http.createServer((req, res) => {
tracker.track(req);
res.end("ok");
}).listen(3000);2. Cloudflare Worker
When your domain sits behind Cloudflare DNS, a Worker runs in front of every request before it reaches your origin (Wix, Webflow, Lovable, WordPress, custom). That captures the bot-side signal a browser pixel cannot, since browsers do not run inside crawlers.
# In your Worker project (see packages/tracker/examples/cloudflare-worker) npm install -g wrangler wrangler login wrangler secret put FOGLIFT_API_KEY # paste sk_fog_... when prompted wrangler deploy
The example Worker in the package repo passes every request through to your origin unchanged. No latency cost on the user's request. Your Foglift dashboard starts showing both crawler and referrer rows within seconds of the first matching visit.
3. Browser pixel (static sites, Wix, Webflow, Lovable, WordPress)
Paste this single tag into your site's head. No npm, no bundler, no package manager. The pixel is 1.8KB minified.
<script async
src="https://foglift.io/pixel.js"
data-foglift-key="sk_fog_..."></script>The pixel can only see referrer signals (ChatGPT, Claude, Perplexity, etc.) because browsers do not run inside crawlers. If you also want crawler-side visibility on a no-code site, the Cloudflare Worker is the full-signal install. The two can coexist on the same domain without double-counting.
What gets tracked
Two source classes, six common engines on each side. The SDK and Cloudflare Worker capture both classes; the pixel captures only the referrer side.
AI Crawlers (User-Agent)
GPTBot· OpenAIClaudeBot· AnthropicPerplexityBot· PerplexityGoogle-Extended· Google AIAmazonbot· AmazonBytespider· ByteDanceCCBot· Common Crawl
AI Engine Referrals (Referer)
chatgpt.com· ChatGPTclaude.ai· Claudeperplexity.ai· Perplexitygemini.google.com· Geminicopilot.microsoft.com· Copilotnotebooklm.google.com· NotebookLM
Honest about edge cases: copy-paste from a chat into the URL bar produces no Referer header at all (estimated 30 to 40 percent of LLM-cited clicks per public studies), so those visits are invisible to every tracker, ours included. Google AI Overview referrals arrive as google.com and are indistinguishable from organic search at the host level. We surface these gaps rather than papering over them with heuristic estimates.
Foglift Tracker vs. general analytics
Plausible, Fathom, and PostHog are excellent for general traffic. They bucket AI engines into 'direct' or 'other' because that is the right default for general analytics. Foglift Tracker is purpose-built for the AI search funnel, so it breaks engines out individually and separates crawls from referrals. Most customers run both.
| Capability | Foglift Tracker | Plausible | Fathom | PostHog |
|---|---|---|---|---|
| Per-engine AI referrals | Yes (6 engines broken out) | No (lumped under 'direct') | No (lumped under 'direct') | No (lumped under 'direct') |
| AI crawler visibility | Yes (7 bots tracked) | No (bots filtered out) | No (bots filtered out) | No (bots filtered out) |
| Cookieless | Yes | Yes | Yes | Configurable |
| Server-side install | Yes (Next.js, Express, Node, Cloudflare) | Pixel only | Pixel only | Yes |
| General page-view analytics | No (out of scope) | Yes (primary use case) | Yes (primary use case) | Yes (plus product analytics) |
Pair Foglift Tracker with whichever general analytics tool you already run. They answer different questions.
Privacy posture
- No cookies. Nothing is set on the visitor, no
Set-Cookieheaders are added by the tracker. - No fingerprinting. No canvas hash, no font enumeration, no IP storage. The tracker reads the User-Agent string, the Referer hostname, and the visited path. That is the entire input.
- No PII. Query strings are stripped from the Referer before reporting. Request bodies and authentication headers are never read.
- No consent banner required by GDPR, ePrivacy, or CCPA, since cookies and PII are absent. Same legal posture as Plausible and Fathom.
- Cross-origin POST to
https://foglift.io/api/v1/crawler-analytics, authenticated by yourX-API-Keyheader. Visits POST over HTTPS only.
Frequently asked questions
What does the Foglift Tracker actually track?
Two signals on the same install. Crawler visits, where the User-Agent matches a known AI crawler (GPTBot, ClaudeBot, PerplexityBot, Google-Extended, Amazonbot, Bytespider, CCBot), are reported as `source: "crawler"` with the matched bot name. Referrer visits, where the User-Agent looks human but the Referer header points at one of six AI engine hostnames (chatgpt.com, claude.ai, perplexity.ai, gemini.google.com, copilot.microsoft.com, notebooklm.google.com), are reported as `source: "referrer"`. If neither matches, nothing is reported. The vast majority of your traffic is invisible to Foglift.
What does the tracker cost?
Free to install on every paid tier (Launch, Growth, Enterprise) and rate-limited on the Free plan. The npm package itself is free; tracker events count against your account quota. Most sites stay well inside the Free plan limits while testing, then move to a paid tier when AI traffic volumes grow.
Does the tracker fingerprint visitors or set cookies?
No. The tracker reads three things per request: the matched User-Agent category, the Referer hostname (query string and path are stripped before reporting), and the path of the visited URL. No cookies are set, no IP is stored, no browser fingerprint is computed. This is by design so the tracker can run without a cookie consent banner under GDPR and similar regimes, the same playbook Plausible and Fathom established.
Will the tracker slow my site down?
No. Reporting is fire-and-forget. The middleware classifies the request synchronously (a string match on UA and Referer, microseconds), then issues an async POST to Foglift's receiver and immediately returns control to your handler. If the receiver is slow or unreachable, your request lifecycle is unaffected. The browser pixel uses `fetch` with `keepalive: true` so the report fires even if the user navigates away.
Why not just use Plausible, Fathom, or PostHog?
General-purpose privacy-friendly analytics tools are excellent at counting page views and sessions, but they bucket AI engines into 'direct' or 'other' because that is the right default for general analytics. Foglift Tracker breaks them out by engine and separates crawl visits from human referrals, which is the breakdown you need to see your AI search funnel. The two are complementary, not substitutes. Plausible answers 'how much organic traffic do I have'; Foglift Tracker answers 'how much of my AI search optimization work is converting into actual visits, and from which engine'.
Can the tracker detect copy-paste from a chat into the URL bar?
No, and neither can anyone else. When a user copies a citation from ChatGPT and pastes it into a new tab, the browser sends no Referer header, so there is no signal to detect. Public studies estimate 30 to 40 percent of LLM-cited link clicks land this way. We surface this honestly rather than blending heuristic estimates into the headline number. The tracker reports what it can verify and labels what it cannot.
Do I need a cookie consent banner?
No banner is required by GDPR, ePrivacy, or CCPA for the tracker because it sets no cookies and stores no PII. The only data sent to Foglift per matching visit is the matched UA category, the Referer hostname, and the visited path. This is the same legal posture as Plausible and Fathom. If your site has its own broader cookie policy, the tracker fits inside it without adding a new consent prompt.
Does the SDK send any of my customer data to Foglift?
No. The SDK only inspects the request's User-Agent, Referer, and path. Request bodies, cookies, query strings, and authentication headers are never read or transmitted. The cross-origin POST to Foglift's receiver is authenticated by your `X-API-Key` header and contains the visit shape only.
What happens if I uninstall?
The tracker stops reporting immediately, on the next deploy. Existing visit data already in your Foglift dashboard stays there for as long as your workspace exists. There is no agent, no scheduled task, and no leftover state. Removing the middleware import is the entire uninstall.
Related
- All Foglift integrations REST API, MCP server, CLI, Slack, Discord, webhooks, Zapier, n8n.
- Foglift MCP Server Run Foglift workflows inside Claude Code, Cursor, and Windsurf.
- Foglift CLI Scan, AI Visibility, sentiment, prompts from the terminal.
- AI Referrals dashboard Per-engine breakdown of crawler hits and human visits.
Install in two minutes
Free plan, no credit card. Generate a key and paste the snippet above.