Ambit Signal

api | install-astro | install-caddy | install-cloudflare | install-express | install-js-tag | install-netlify | install-nginx | install-shopify | install-squarespace | install-sveltekit | install-vercel-next | install-webflow | install-wix | install-wordpress | mcp | outcomes | privacy | quickstart | troubleshooting

Install: Vercel / Next.js

Collection: server collector (sees bots and humans). Replace example.com and st_YOURSITEID with your site's values (dashboard, list_sites, or GET /v1/sites). The MCP tool get_install_snippet(platform="vercel-next", site_id=...) returns this page pre-filled.

Steps

  1. npm install @ambit/signal
  2. Create middleware.ts in the project root (next to app/ or pages/), or wrap your existing middleware with withAmbitSignal.
  3. Vercel > Project Settings > Environment Variables (Production): add AMBIT_SIGNAL_SITE and AMBIT_SIGNAL_SECRET.
  4. Redeploy.

File: middleware.ts

import { withAmbitSignal } from "@ambit/signal/next";

// Wraps your middleware (or a pass-through if you have none). Reports after the response.
export const middleware = withAmbitSignal();

export const config = {
  matcher: ["/((?!_next/static|_next/image|favicon.ico|.*\\.(?:css|js|png|jpg|jpeg|gif|webp|svg|ico|woff2?)$).*)"],
};

Configuration

Name Value
AMBIT_SIGNAL_SITE example.com
AMBIT_SIGNAL_SECRET <SECRET>

<SECRET> is the site secret shown once when the site was created. Lost it? Rotate it in the dashboard (Site > Keys) or ask ambit; the old secret stops working immediately.

Verify

Load any page of example.com once, then check: MCP tool verify_install(site_id="st_YOURSITEID") or GET https://signal.ambit.agency/v1/sites/st_YOURSITEID/status with your API key. "receiving": true means events are arriving (usually within a minute).

curl -s -H "Authorization: Bearer $AMBIT_SIGNAL_API_KEY" \
  https://signal.ambit.agency/v1/sites/st_YOURSITEID/status

Expected: "receiving": true. If not, see troubleshooting.

Notes