# Replacing Google Optimize with the Vercel Edge Network

**Published:** March 30, 2023 | **Authors:** Anthony Shew | **Category:** Field Engineering

*Power your A/B testing and personalization strategy with data and performance\.*

---

Since 2012, Google Optimize has been helping web builders experiment with their UIs to find the most effective patterns for their applications. However, Google has [announced](https://support.google.com/optimize/answer/12979939?hl=en) that Optimize will be sunset on September 30, 2023.

Vercel is ready to help you build a platform to **continue your research with higher performance, more control, and better data** by leveraging the edge.

> **Note:** This post is historical and describes Edge Functions as they existed at the time. For new projects, use [Vercel Functions](https://vercel.com/docs/functions) with the Node.js runtime and [Fluid compute](https://vercel.com/docs/fluid-compute).

With Vercel, you can recreate your Optimize experiments with:

- Sub-millisecond configuration read times
- No code using your Vercel dashboard
- Your existing data ingestion solution

**Modernize your experimentation stack**
Start your transition today.
[Let's Talk](https://vercel.com/contact/sales)

## Google Optimize performance opportunities

In the past, it's been difficult to run experiments in ways that don't harm page performance.

- **Google Optimize's scripts** must be loaded on every page where you intend to perform an experiment, adding weight to your page size and increasing load times.
- ****[Cumulative Layout Shift (CLS)](https://vercel.com/docs/concepts/analytics/web-vitals#cumulative-layout-shift-cls) hurts your application's SEO and UX—but is often introduced accidentally when running UI experiments on the client side.
- **Server-side latency** increases when your server has to make calls to Google Optimize to figure out which experiments are currently being ran.

Instead, you can introduce [Vercel Edge Config](https://vercel.com/docs/edge-config) and [Routing Middleware](https://vercel.com/docs/routing-middleware) to your experimentation framework to build a high-performance testing engine.

## What is the edge?

The [Vercel CDN](https://vercel.com/docs/cdn) sits between the internet and your Vercel deployments acting as a Content Delivery network (CDN) with the ability to execute functions as close to your user or data as possible.

![Google Optimize, Edge globe (light)](//images.ctfassets.net/e5382hct74si/5dg96p0Es3W8ico3GdsX9Y/74716f2d1e017c49afaff140fd09ab0c/Inline_Graphic-Dark-V3.png)

This means that the building blocks of your application will always be served from the geographically closest data center in the CDN, ensuring that your users experience the best performance possible.

With Vercel, you have several features that you can use together to **replicate and enhance** Google Optimize's experimenting functionality: Edge Config and Routing Middleware.

## Sub-millisecond experiments with Edge Config

Vercel Edge Config is a small data store for distributing your data to Vercel regions where it can be replicated globally. Your experiments data becomes available **instantly** and can be fetched in less than 10ms on average, letting you iterate on your experiments faster.

Once you've [created your Edge Config](https://vercel.com/docs/edge-config), you can fetch its data in [Routing Middleware](https://vercel.com/docs/routing-middleware) for request-routing decisions or in [Vercel Functions](https://vercel.com/docs/functions) for backend logic. You can then use this payload in your experimentation logic to create a powerful platform for your testing needs.

## Eliminating Cumulative Layout Shift

Embracing the edge also lets us significantly reduce [Cumulative Layout Shift (CLS)](https://vercel.com/docs/concepts/analytics/web-vitals#cumulative-layout-shift-cls) by making sure that we serve statically rendered content at the speed of dynamic. Using primitives from Next.js and Vercel

With [Routing Middleware](https://vercel.com/docs/routing-middleware), you can read your Edge Config to serve the correct variant of your page instantly rather than computing the variant on the client after the page's initial load. Speedway Motors cut their CLS by 50% using this strategy as shown by [Vercel Analytics](https://vercel.com/docs/concepts/analytics/web-vitals).

![Cumulative Layout Shift for Speedway Motors was reduced by 50%.](//images.ctfassets.net/e5382hct74si/y2jv6UbAxix5NIZZCHssA/3c386fb82f9fb8faa04d0b6247b40832/Slice_1__2_.png)
*Cumulative Layout Shift for Speedway Motors was reduced by 50%.*

## Track results

To analyze how your experiment is doing, you can leverage your current data solution of choice, passing in the context of your experiment as properties of your data.

**CheckoutButton.tsx**
```tsx
import { saveData } from'@your-data-provider/sdk';

export const CheckoutButton = () => { 

  useEffect(() => {
    // Track how many times button was rendered
    // and which experiments were active
    saveData("Checkout button impression", {
      isWinterSale: true,
      saleColor: "red", 
      buttonColor: "blue"
    })
  }, [])

  const handleClick = () => {
    // Track when a user clicks the button
    // and which experiments were active  
    saveData("Checkout button click", {
      isWinterSale: true,
      saleColor: "red", 
      buttonColor: "blue"
    })

    // Your checkout logic
    console.log("Check out!")
  }

  return (
    <button onClick={() => handleClick()}>
      Checkout
    </button>
  )
}
```

In the future, we're looking forward to adding more features to track your experiments.

## Experiment faster by default

We want to help you replace your experiments** **and **make them even better.**

By taking your experiments to the edge, the tests that you were running with Google Optimize can be incrementally migrated to improve your page performance while still collecting the valuable experimentation data that drives your business.

**Talk to a migration expert**
Start building a cleaner enterprise-grade stack.
[Contact Sales](https://vercel.com/contact/sales)

---

**More posts:** [View all blog posts](https://vercel.com/blog/sitemap.md) | [Changelog](https://vercel.com/changelog/sitemap.md)