Trakkr Docs

Netlify Setup

:::summarybox achieve Connect your Netlify account via OAuth Add a one-file Edge Function to your repo Start receiving AI crawler data in real time


Before you start

You'll need:


Step 1: Connect via OAuth

  1. Open Crawler in Trakkr (under Traffic). Click Add source in the header if you already have other sources.
  2. Under Hosting platform, pick Netlify.
  3. Click Continue to Netlify. You'll be redirected to Netlify in the same tab.
  4. Approve Trakkr's access. The grant lets us list the sites on your team so you can pick the right one — we don't read site content, deploy code, or touch your DNS.
  5. Netlify redirects you back to Trakkr.

Step 2: Pick a site

After authorization, pick the site you want to track. Trakkr saves the selection and shows the Pending Edge Setup card with the file and three environment variables you need.


Step 3: Add the Edge Function to your repo

In your site's repo, create the file:

netlify/edge-functions/trakkr-crawler.ts

Copy the edge template from the Trakkr setup card into that file, then commit and push. Netlify picks up the path automatically — no netlify.toml change required.


Step 4: Set three environment variables

In Netlify, open Site configuration → Environment variables (or use the Netlify CLI) and add:

TRAKKR_CONNECTION_ID=<your-connection-id>
TRAKKR_WEBHOOK_SECRET=<your-webhook-secret>
TRAKKR_INGEST_URL=https://api.trakkr.ai/crawler-connect/ingest/netlify

All three values are visible in the Trakkr setup card. Without them the function will still run, but Trakkr will reject the payloads as unauthorised.


Step 5: Deploy and verify

Push your commit, or trigger a manual deploy: Deploys → Trigger deploy → Clear cache and deploy site.

Once it's live, click Send verification in the Crawler header. The synthetic GPTBot ping should appear in the Feed within 30 seconds.


How the Edge Function works

The function runs at Netlify's edge, in front of your origin, on every request to your site. For each request it lets the response through first, then — only if the request came from a known AI crawler — fires a small POST to Trakkr in the background.

The outbound POST is fire-and-forget (via Netlify's waitUntil), so it doesn't add any perceptible latency for your visitors. The function never modifies your HTML, headers, or behavior.


Troubleshooting

OAuth didn't complete

No data after deploying

Edge function runs but Trakkr Feed is empty

Almost always a missing or wrong env var. Open the Netlify deploy logs and search for TRAKKR_ — if you see warnings about undefined env vars, fix them in Site configuration → Environment variables and redeploy.

Edge Function errors

Check Netlify's Edge Functions tab in your site dashboard for error logs. Contact support if the function fails to deploy.


Revoking access

To disconnect:

  1. Remove the connection in Trakkr (Crawler → the connection card → Disconnect).
  2. To remove the function entirely, delete netlify/edge-functions/trakkr-crawler.ts from your repo and deploy. Otherwise it stays in place but stops forwarding (the env vars no longer match an active connection).
  3. Optionally, revoke Trakkr's OAuth grant in Netlify: User settings → Applications → Authorized apps → Trakkr.

Next steps