A/B Testing on Vercel

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 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 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:

View more templates.

Couldn't find the guide you need?