← All IntegrationsIntegration

Analytics for Vercel

BetterMeter runs on Vercel itself — so we know firsthand how to get the most out of it. Proxy the tracker through your own domain with vercel.json rewrites, track edge-rendered pages with zero configuration, and instrument Serverless Functions with the Node SDK.

Proxy rewrites for ad-blocker bypass

Ad blockers target third-party analytics domains. By proxying BetterMeter through your own Vercel domain, the tracker script, the event endpoint and the noscript pixel all appear first-party. Add all three rewrites to your vercel.json — the script alone is not enough, since it is the events that carry your traffic.

vercel.json
{
  "rewrites": [
    { "source": "/bm/s", "destination": "https://bettermeter.com/api/s" },
    { "source": "/bm/e", "destination": "https://bettermeter.com/api/e" },
    { "source": "/bm/p", "destination": "https://bettermeter.com/api/p" }
  ]
}

Then point the snippet at those paths. The data-api attribute is the load-bearing part: without it the tracker derives its event endpoint from the script's own origin and posts to /api/e on your domain, which nothing serves. The script still loads, the install still looks correct, and not one event is recorded.

Proxied snippet
<script defer data-site="your-domain.com" data-api="/bm/e" src="/bm/s"></script>
<img src="/bm/p?s=your-domain.com" alt="" style="position:absolute;width:0;height:0;overflow:hidden" />

Edge rendering & Serverless Functions

  • 01BetterMeter's tracker runs client-side, so it works identically whether your page is edge-rendered, ISR, SSR, or static.
  • 02Vercel's Edge Network serves from 20+ regions — the tracker detects the visitor's actual country, not the edge node location.
  • 03For Serverless Functions and API routes, use the @bettermeter/node SDK to track API usage alongside web traffic.
  • 04Vercel Cron Jobs can automate BetterMeter reports — schedule weekly traffic summaries or anomaly checks.
First-Party Proxy
Via vercel.json rewrites
Edge Compatible
All render modes
AI Detection
ChatGPT, Claude, Perplexity
No Cookies
GDPR-compliant
~4 KB
Script size, gzipped