Documentation/Integrations/Server-side Tracker

Server-side tracker

The Rampify JS tracker fires when a browser executes JavaScript, which catches every human visitor. But LLM agents (ChatGPT-User, Claude-User, Perplexity-User), training crawlers (Bytespider, GPTBot, anthropic-ai), and search/bot crawlers (Googlebot, Bingbot) all fetch server-side. They never run JavaScript. The standard tracker can't see them.

Every analytics product on the market has this gap: Plausible, GA4, Umami, PostHog, Fathom are all JS-only. As AI search becomes the dominant content-consumption surface, JS-only analytics are blind to half the traffic story.

The Rampify server-side tracker fills that gap. Drop a single file into your Netlify or Vercel project, set one env var, and every page request reaches Rampify, which works out on its own servers whether it came from a person, an AI agent, a crawler or a script. Your site behaves exactly as before.

Where to install

Open your project's Settings page in the Rampify dashboard (left sidebar → Settings). The "Project API Key" panel generates the key you'll need for the steps below. The same key works for both the server-side tracker and the MCP server.

Install it on your marketing site first: that's where AI agents and crawlers arrive. If your app lives on a separate subdomain (for example app.example.com), adding it there too is optional. Signed-in app pages rarely get agent traffic, and the JS tracker already covers the people using them. Use the same key in both places; every request is recorded with its host, so the two stay separate.

How it works#

The template installs as an edge function: a small piece of code that runs on every request to your site, before reaching your origin. It is a plain forwarder:

  1. Skip requests that aren't page visits: anything but GET, static assets, API paths, framework internals, and browser prefetches. The files AI agents and crawlers read, llms.txt, llms-full.txt, robots.txt, sitemaps and /.well-known/ files, are deliberately kept.
  2. Send the request's details to https://www.rampify.dev/api/collect with your project's API key, fire-and-forget, then return control to your site straight away.
  3. Rampify decides who the visitor was. Recognising a newly launched AI agent is a change on Rampify's side, so you never need to update the template for it.

If anything fails (missing API key, network error, Rampify is down) the function falls through silently, and the request to Rampify gives up after 1.5 seconds. Your site continues to render exactly as it did before. There is no failure mode where the tracker breaks your site.

Audit the code before you install#

The template is short, self-contained, and has no hidden imports. Read it before you deploy:

Choose a mode#

Set RAMPIFY_MODE in your environment variables. Full mode is the default.

Full mode (default)#

Sends every page request, from people and bots alike, with:

  • URL requested, including the query string. Rampify removes the values of sensitive parameters (tokens, codes, passwords, email addresses) before storing anything.
  • Referrer header (if present)
  • User-Agent string verbatim
  • Country and region code, pre-resolved by your platform's edge (for example US / CA)
  • A fixed list of standard request headers: Sec-Fetch-Mode, Sec-Fetch-Dest, Sec-Fetch-Site, Sec-Fetch-User, Sec-Purpose, Purpose, Accept, Accept-Language, From, Upgrade-Insecure-Requests, the Sec-CH-UA client hints, and the Web Bot Auth headers (Signature, Signature-Input, Signature-Agent) that signed AI agents send
  • The platform's request id, the template version, and the kind of request (a page load, an in-page navigation, a plain fetch, or an agent file)

Why send people's requests too? Some crawlers disguise themselves as browsers. If the template skipped everything that looked human, those crawlers would vanish. Rampify keeps people's requests only as a cross-check: people are counted by the JS tracker, so your human numbers don't double.

Minimal mode#

RAMPIFY_MODE=minimal sends only requests whose User-Agent looks automated (a known AI agent, crawler, unfurler or script), with just the page URL without its query string and the User-Agent. Choose it if you'd rather no data about people leaves your site. The trade-off: crawlers disguised as browsers aren't seen.

What the template never does#

  • No visitor IPs leave your edge. Country and region are resolved by Netlify or Vercel before the function runs; we only receive the codes.
  • No cookies, no authorization headers, and no header outside the list above. No identifier is set on the visitor.
  • No JavaScript injected into your pages. This runs server-side only.
  • No requests modified. The function passes the original request through unchanged. Your origin sees exactly what it saw before.

Rampify keeps the request records for 90 days, then deletes them; the counts and summaries in your dashboard are kept.

Sampling and pausing#

Rampify can tell the template to send less: a share (for example 1 in 10) of one kind of request, or a pause. It can never tell it to send more than the rules above. The instruction rides back on Rampify's response, lasts at most 10 minutes, and the template goes back to its defaults when it expires. Rows kept from a sample record their rate, so counts are scaled back up. By default nothing is sampled.

To stop sending without removing the file, set RAMPIFY_TRACKING=off and redeploy.

Install on Netlify#

The template uses Netlify Edge Functions (Deno runtime, free tier 1M invocations/month).

1. Generate an API key#

In the Rampify dashboard, open Settings for your project and click Generate key in the Project API Key panel. Copy the sk_live_… value, which you'll only see once.

2. Set the environment variable#

In Netlify → Site configuration → Environment variables, add:

RAMPIFY_API_KEY=sk_live_…  (paste your key here)

3. Add the edge function#

From your project root:

mkdir -p netlify/edge-functions && \
  curl -o netlify/edge-functions/rampify.ts \
       https://www.rampify.dev/api/templates/netlify-edge-tracker.ts

4. Wire it up in netlify.toml#

[[edge_functions]]
  path = "/*"
  function = "rampify"

5. Deploy#

Push to your repo. Netlify auto-deploys the edge function. Back in Rampify Settings, the Server-side tracker traffic panel will transition from "Waiting for first event…" to "N events in last 24h" once a bot or LLM agent visits your site.

To force an immediate test, hit your site with a bot UA:

curl -A 'Claude-User/1.0' https://your-domain.com/

You should see the event in the Rampify dashboard within seconds.

Install on Vercel#

The template uses Next.js routing-middleware (proxy.ts for Next.js 16+, middleware.ts for ≤15).

1. Generate an API key#

Same as Netlify: open Settings for your project and click Generate key in the Project API Key panel.

2. Set the environment variable#

In Vercel → Project settings → Environment Variables, add:

RAMPIFY_API_KEY=sk_live_…  (paste your key here)

3. Install the Vercel runtime helper#

npm install @vercel/functions

4. Drop the middleware at the project root#

For Next.js 16 or later:

curl -o proxy.ts https://www.rampify.dev/api/templates/vercel-proxy.ts

For Next.js 15 or earlier, save it as middleware.ts instead. (The exported function name middleware is what Next.js looks up; the filename varies by version.)

5. Deploy#

Push to your repo. Vercel auto-deploys the middleware. Back in Rampify Settings, the Server-side tracker traffic panel will transition once the first bot/agent request hits your site.

What the dashboard shows after install#

The Server-side tracker traffic panel on your project's Settings page polls every 10 seconds and updates the status block:

  • "Waiting for first event…" means the function is deployed but no bot has visited yet, or the API key isn't reaching Rampify.
  • "N events in last 24h" means bot/LLM-agent traffic is flowing. Sample user-agents are listed below for sanity-checking.

The full per-event breakdown (which bot, which page, when) lives on the existing Traffic dashboard. Filter by visitor_type to see just LLM agents or just crawlers.

Keeping the template up to date#

The template is a copy in your repo. Rampify classifies every request it receives on its own servers, so recognising new agents and fixing classification never needs a change on your side.

Version 2 (October 2026) is a plain forwarder: it no longer decides which requests look like bots, so crawlers that disguise themselves as browsers are no longer missed. It adds minimal mode, the off switch, sampling and the 1.5 second timeout. The first version only sent requests whose User-Agent matched a built-in list; it keeps working, and your Settings page shows "update available" once version 2 is recommended for your project. To update, download the template again with the same curl command from the install steps above and redeploy. Your API key doesn't change. If you merged the template into an existing proxy.ts or middleware.ts, replace the old trackPageview code with the new file's trackRequest function and the constants above it, and call trackRequest(request) from your handler.

Privacy#

In full mode the template sends what any web server log records about a page request (URL, referrer, User-Agent, standard request headers, pre-resolved geo), for people as well as bots. Minimal mode sends only automated visits, without query strings. Visitor IPs never reach Rampify. Geo is resolved at your platform's edge (Netlify and Vercel both expose it) and only the pre-resolved values are sent. Rampify keeps the request records for 90 days.

The tracker uses no cookies, fingerprinting, or third-party identifiers. Your site's privacy policy should disclose that you use server-side analytics, which is your responsibility, not Rampify's. Questions about what we collect: info@rampify.dev.

Troubleshooting#

The status panel still says "Waiting for first event…" after I deploy.

  • Check that RAMPIFY_API_KEY is set on the deployed environment (not just local).
  • Hit your site with a bot UA: curl -A 'Claude-User/1.0' https://your-domain.com/. If that produces an event, the tracker is working, and you just hadn't received any real bot traffic yet.
  • View your platform's edge function logs. The template logs [rampify] collect failed: on any non-2xx response from /api/collect.

My site has noticeably higher latency after install.

The template uses fire-and-forget, so the POST to Rampify never blocks the response. But every request now passes through the edge function before reaching your origin, which adds ~5–20ms even when the function is a no-op. If that's not acceptable, narrow the matcher in netlify.toml (Netlify) or config.matcher (Vercel) to only the routes you care about.

Can I see what the template does before installing?

Yes. Both templates are served as plain text:

Everything the template sends is listed in the FORWARDED_HEADERS constant and the request body near the bottom of each file, with no hidden imports and nothing magic. Audit before you deploy.