Vercel Marketplace integration

The Vercel Marketplace integration adds PostHog feature flags and experiments to your Vercel projects with billing handled through Vercel.

Choose this integration if you do not already have a PostHog account and you prefer to consolidate payment for PostHog inside your Vercel invoice.

New organizations only

This integration creates a new PostHog organization. You cannot migrate an existing PostHog organization to be billed through Vercel.

Installing the integration

  1. Go to the PostHog integration page on Vercel Marketplace
  2. Click Install

This creates a PostHog organization and project, and adds environment variables to your Vercel project.

Environment variables

The integration adds these environment variables to your Vercel project:

  • POSTHOG_PROJECT_API_KEY - Your project API key, used to initialize the PostHog SDK
  • POSTHOG_HOST - The PostHog API host URL (either https://us.i.posthog.com or https://eu.i.posthog.com)

For client-side frameworks, you'll need to rename these variables in your Vercel project settings to expose them to the browser:

FrameworkRename to
Next.jsNEXT_PUBLIC_POSTHOG_KEY, NEXT_PUBLIC_POSTHOG_HOST
Vite/SvelteKitVITE_POSTHOG_KEY, VITE_POSTHOG_HOST
NuxtNUXT_PUBLIC_POSTHOG_KEY, NUXT_PUBLIC_POSTHOG_HOST

Server-side code can use the original names directly.

Installing the SDK

The fastest way to add PostHog to your application is using our installation wizard. Alternatively, follow your framework's guide:

By default, you'll also get session replay and event autocapture. If you prefer to use feature flags only, you can opt out:

JavaScript
posthog.init('<ph_project_api_key>', {
api_host: 'https://us.i.posthog.com',
autocapture: false,
disable_session_recording: true
})

Using feature flags

To use feature flags in your application:

JavaScript
if (posthog.isFeatureEnabled('new-checkout')) {
// Show new checkout
} else {
// Show old checkout
}

For more examples, see our feature flag code guide.

Creating feature flags and experiments

Access the PostHog dashboard from your Vercel project's Integrations tab or directly at app.posthog.com.

Feature flags and experiments you create automatically sync with Vercel's flags dashboard.

For full documentation:

Billing

Billing goes through your Vercel account. View usage in Vercel under IntegrationsPostHog.

See our pricing page for more details.

Limitations

  • One organization per Vercel team - Cannot link multiple PostHog organizations
  • Cloud only - No self-hosted support (US or EU regions available)
  • Region cannot be changed - US or EU is selected during installation
  • One-way team sync - Vercel team changes sync to PostHog, not vice versa

Further reading

Community questions

Was this page useful?

Questions about this page? or post a community question.