Vercel — Manual Setup

Add JustAnalytics to a Vercel-hosted project by setting environment variables and dropping in the tracking script.

Vercel — Manual Setup

JustAnalytics works on any Vercel project — there is nothing Vercel-specific you have to do to receive frontend analytics, error tracking, or APM data. This page describes the manual setup that works today.

A one-click Vercel Marketplace integration is planned but not yet published — see Future Work below.

Time to data: 3 minutes

Prerequisites#

  • A JustAnalytics account with at least one site
  • A Vercel project (any framework — Next.js, SvelteKit, Astro, Remix, vanilla)

Step 1 — Add environment variables on Vercel#

In your Vercel project: Settings → Environment Variables. Add the following, sourced from your JustAnalytics dashboard's API Keys page:

NEXT_PUBLIC_JUSTANALYTICS_SITE_ID=cmkc0xbe70001fdge4feizme8
JUSTANALYTICS_API_KEY=ja_prod_XXXXXXXXXXXX

The NEXT_PUBLIC_ prefix is only needed if you want to read the value from Next.js client code. For server-only SDK use, the unprefixed form is enough.

Step 2 — Add the tracking script#

For Next.js App Router (app/layout.tsx):

export default function RootLayout({ children }) {
  return (
    <html>
      <head>
        <script
          defer
          src="https://justanalytics.app/tracker.js"
          data-site-id={process.env.NEXT_PUBLIC_JUSTANALYTICS_SITE_ID}>
        </script>
      </head>
      <body>{children}</body>
    </html>
  );
}

For any other framework, paste the same <script> tag into your root template's <head>.

Step 3 — (Optional) Server-side SDK for Next.js#

If you want server-side tracing of API routes, server actions, and edge functions, install the Node SDK:

npm install @justanalyticsapp/node

Initialise it in instrumentation.ts at the repo root:

export async function register() {
  const JA = (await import('@justanalyticsapp/node')).default;
  JA.init({
    apiKey: process.env.JUSTANALYTICS_API_KEY,
    serviceName: 'my-vercel-app',
    environment: process.env.VERCEL_ENV ?? 'development',
    release: process.env.VERCEL_GIT_COMMIT_SHA,
  });
}

Setting release from VERCEL_GIT_COMMIT_SHA gives you per-deployment release tracking and regression detection — without any Vercel-side integration.

Verification#

Visit your deployed site in a new browser tab and watch the JustAnalytics dashboard — the visit should appear within seconds.


Future Work#

A one-click Vercel Marketplace integration is on the roadmap. When published, it will:

  • Auto-set JUSTANALYTICS_SITE_ID, JUSTANALYTICS_API_KEY, and JUSTANALYTICS_ENDPOINT on the linked project
  • Register deployment webhooks so each Vercel deploy automatically becomes a JustAnalytics release
  • Surface Vercel-side build metadata (commit SHA, branch, deploy ID) on every error and trace

Until then, the manual setup above gives you the same data — you just configure the variables yourself.