Skip to main content


Optimizely Knowledge Base

CDN load balancing: How Optimizely affects page load speed

Skip Ahead

  • Set up Optimizely to minimize impact to the load speed of your page
  • Adjust Optimizely settings to shrink the snippet size

When you implement the Optimizely snippet according to our best practices, you may wonder how Optimizely will affect your site's load speed. Traditional web development best practices dictate that any third-party JavaScript file, like Optimizely's snippet, should go at the bottom of the page and be loaded asynchronously. This approach is intended to ensure that even if these resources load slowly, they do not affect the user's visual experience.

However, Optimizely works by changing the visual experience on the page as the site loads, making these changes before the visitor sees any content. When customers implement the Optimizely snippet synchronously and in the head tag, the snippet can execute its changes before the content loads, and customers experience a minimal increase in page load speed.

There are two primary ways that Optimizely may affect load speed: latency and flashing. Read on to learn:

  • What impacts load speeds

  • How Optimizely controls for performance

  • Best practices to avoid any issues


Latency refers to when a page is slow to load or render. This is easily noticeable when a web page takes a long time to display in a browser, images slowly appear, or the site's fonts and styles take a long time to apply to text.

Web pages load through a series of steps as the browser requests and receives all the various resources that make up that page (images, CSS files, JavaScript files, etc.). The five basic steps of how a page renders are listed below:

  1. DNS Lookup - finding the requested resource's web address (e.g.

  2. Initial Connection - successfully talking to that resource's address

  3. TTFB (time to first byte) - receiving the very first piece of information from the resource (e.g. the first piece of information from Optimizely's CDN)

  4. Download/TTLB (time to last byte) - receiving the very last piece of information from the resource, thus allowing the resource to render visually (e.g. an image) or execute (e.g. Optimizely's JavaScript snippet can begin its functionality)

  5. Document Complete - the primary road sign that the web page has completed loading all of its resources

How does Optimizely affect how long these steps might take?

Optimizely uses a Content Delivery Network (CDN), a network of web servers located around the world, to provide service for the rendering the snippet according to the steps outlined above. It is important to note that Optimizely and its CDN only impact steps #3-5, because that is when the request for the snippet has reached the CDN. Optimizely balances every request so it can deliver the snippet to the visitor's browser from the physically closest server and highest-performing CDN. This approach allows the snippet to load as quickly as possible in the browser for as many requests as possible, so that even when loading synchronously, Optimizely does not block other assets on the page. You may read more about Optimizely's approach to CDN balancing here.

Optimizely dynamically load-balances between the two fastest and most widely used CDNs in the world, Akamai and EdgeCast. This makes the round trip as part of TTFB shorter, and reaches TTLB sooner, so Optimizely can make changes on the site that much longer before Document Complete. This approach dramatically decreases response times for 99% of website visitors, and allows customers to maximize the ROI from experiments.

If you have any questions about our approach to the delivery of the snippet, or have a load speed report from your site that you'd like us to review with you, please contact support.


Flashing, sometimes also called flickering, refers to when a page loads the original content for a short time before loading different content, creating a noticeable "flash" of the page.  This can create a disruptive experience for website visitors and distract from the effectiveness of the content being tested.

When using Optimizely please consider the following:

  1. Placement on Page. Place the snippet as high in the head tag as possible. Unlike most third-party scripts, the snippet affects the visual user experience, and not just collects data on it. It is important to load Optimizely before other content on the page to provide the desired visitor experience.

    Search Engine Optimization (SEO) historically advises third-party scripts be placed low on the page. However, Google permits and encourages A/B or multivariate tests and has stated that testing poses no inherent risk to a site's search rank. Read more about AB Testing and Search Engine Optimization.

  2. Synchronous vs. Asynchronous Loading. Loading the snippet on a page asynchronously increases the risk of flashing on the page. Learn more about synchronous and asynchronous snippet loading.

  3. Tag Manager. Don't put the snippet in your Tag Manager.

    If you do decide to load Optimizely through a Tag Manager, make sure to place it high on the page, set Optimizely to load first, and to load synchronously. This will help ensure Optimizely can execute quickly and make changes before the original page loads. Read more about proper Google Tag Manager or other Tag Manager implementations.

  4. Snippet Size. The size of the Optimizely snippet can greatly impact how testing affects your load time. The snippet contains the information of any running experiments, all audience and goal definitions, and the jQuery library.

    Some simple best practices for controlling the snippet's size include archiving completed experiments, writing reused code in Project JavaScript instead of Experiment JavaScript, or removing jQuery if the library already exists at a higher point in the head tag. Optimizely has a great new feature, the Snippet Inspector, that can provide insight into what's contributing to your snippet size.

If you experience any issues with flashing please refer to our troubleshooting Article or contact support.

Google's Page Speed Test / Score -- example response:

Google's page speed test is a mechanism that identifies optimal ways of increasing the efficiency of page load time. There are many factors that go into the page speed score, such as how many of the resources are cached, are JS files minified, and are there any render blocking scripts present within the head tag?

As a result, it will programmatically surface any synchronous 3rd party scripts on the page such as the Optimizely snippet. The topic of discussion here is what is the business value that is being driven? Does the value of conducting best practices of AB testing to retrieve business insights about customer behavior from using the AB testing tool outweigh the effect on page speed score (such is just one of many factors of Google's vague definition of SEO and doesn't measure Optimizely's true effect on actual page load time)? It's especially important to continue implementing Optimizely synchronously in the head tag if testing on above-the-fold content as flashing of original content may occur if implemented in any other way.

Google has also encouraged AB testing on sites as the conclusion of AB tests allow users to reach landing pages and sites to find what they're looking for more efficiently:

Lastly, Optimizely does do everything it can do minimize the effect the Optimizely snippet has on actual page load time. We utilize 2 CDN Providers and serve the snippet from the closest and most efficient CDN Provider to the user. There are also ways to decrease the size of the Optimizely snippet as well. This is all outlined within our knowledge base article, which you can find - here.