---
title: A/B Testing on Vercel
description: Learn best practices for A/B testing on Vercel
url: /kb/guide/ab-testing-on-vercel
canonical_url: "https://vercel.com/kb/guide/ab-testing-on-vercel"
published: 2025-11-03
last_updated: 2025-11-10
authors: Rich Haines
related:
  - /docs/concepts/functions/edge-middleware
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---
<!-- docsgraph:related -->
## Related pages

> **For AI agents:** Follow these links to understand how this page connects to the rest of the Vercel ecosystem. For the full cross-link map (inbound, outbound, prerequisites, and semantic neighbors), see the .graph.md link below.

- [Incremental Migration](https://vercel.com/docs/incremental-migration?from=related) — Learn how to migrate your app or website to Vercel with minimal risk and high impact.
- [Kubernetes](https://vercel.com/docs/integrations/external-platforms/kubernetes?from=related) — Deploy your frontend on Vercel alongside your existing Kubernetes infrastructure.
- [Run an A/B Test](https://vercel.com/docs/flags/vercel-flags/cli/run-ab-test?from=related) — Set up an A/B test with a feature flag, track results through Web Analytics, and clean up afterward using the Vercel CLI
- [Insights](https://vercel.com/docs/observability/insights?from=related) — List of available data sources that you can view and monitor with Observability on Vercel.
- [All Frameworks](https://vercel.com/docs/frameworks/more-frameworks?from=related) — Learn about the frameworks that can be deployed to Vercel.
- [How to Integrate Optimizely Feature Experimentation with Next.js and Vercel](https://vercel.com/kb/guide/how-to-integrate-optimizely-feature-experimentation-next-vercel?from=related) — This guide covers setting up feature flags, implementing A/B tests, and optimizing performance using React Server Compon
- [Monitor Frontend Performance with DebugBear and Vercel](https://vercel.com/kb/guide/monitor-frontend-performance-with-debugbear-and-vercel?from=related) — Automatically test each Vercel deployment and report performance changes to GitHub.
- [Using Vercel as a Standalone CDN](https://vercel.com/kb/guide/using_vercel_as_a_cdn?from=related) — Use Vercel's external rewrites to proxy and cache content from external websites or APIs through Vercel's global edge ne
- [What is Vercel's policy regarding load testing deployments?](https://vercel.com/kb/guide/what-s-vercel-s-policy-regarding-load-testing-deployments?from=related) — Learn about Vercel's policies regarding load tests.
- [Using a Headless CMS with Vercel](https://vercel.com/kb/guide/using-a-headless-cms-with-vercel?from=related) — Learn best practices for using databases in a serverless environment with Vercel

Full cross-link map for this page: [/kb/guide/ab-testing-on-vercel.graph.md](/kb/guide/ab-testing-on-vercel.graph.md)
<!-- /docsgraph:related -->


A/B testing allows you to serve different versions of your site to different groups of visitors. This could be two versions, split at 50% of your traffic, or as complex as thousands of small experiments to optimize the content shown on screen.

One example application of A/B testing is news sites. When you land on a news article, the headline has been carefully selected for you. For example, the experiment might start out as a split test between two headlines:

1. ”How Next.js is bringing dynamic at the speed of static”
   
2. ”A/B testing and high-performance personalization with Next.js”
   

After monitoring the experiment, metrics show option two has higher click-through rates. The headline is then updated to use the higher performing variation. Other metrics besides click-through rates could be used, including:

- User conversion
  
- User engagement
  
- Sessions
  
- Bounce rate
  

## Edge Middleware

[Middleware](https://vercel.com/docs/concepts/functions/edge-middleware) allows you to run code before a request is completed. This gives you full flexibility to add A/B testing and personalization to any part of your application, all defined as code instead of configuration.

A/B testing on the server-side with [Edge Middleware](https://vercel.com/resources/edge-middleware-experiments-personalization-performance) reduces layout shift by preventing client-loaded experiments and improves your site's performance by serving smaller JavaScript bundles.

Because you have access to the incoming request and `User-Agent`, you can also prevent bots or search crawlers from hitting experiments.

## Providers

Edge Middleware can be used with any third-party library or service to run experiments and A/B testing, including:

- [A/B Testing with Cookies](https://vercel.com/templates/next.js/cookies)
  
- [Configcat](https://vercel.com/templates/next.js/ab-testing-configcat)
  
- [Split](https://vercel.com/templates/next.js/ab-testing-split)
  
- [Builder.io](https://vercel.com/templates/next.js/personalization-builder-io)
  
- [Google Optimize](https://vercel.com/templates/next.js/ab-testing-google-optimize)
  
- [Statsig](https://vercel.com/templates/next.js/ab-testing-statsig)
  

View more [templates](https://vercel.com/templates?type=edge-functions).