Project Settings: Cache Expiration (TTL)

  • Updated
  • Optimizely Web Experimentation

When visitors land on your site, they need to download all the code that runs on your site, including the Optimizely Web Experimentation snippet. The more code, the longer it takes. Caching helps avoid long download times by storing your site's code after the first-time visitors download it, so they do not need to download anything on the next page they visit.

Caching provides better site performance, but visitors do not see the updated snippet if you change it because they are running the older cached copy of your site.

To compromise, Optimizely Web Experimentation privacy settings include the Cache Expiration (TTL) feature. Use this feature to customize how long the snippet is cached before visitors' browsers check for new content—the snippet's "time-to-live" (TTL).

Here is where to find the Cache Expiration (TTL) feature:

  1. Go to Settings > Implementation.

  2. Click the name of the snippet whose settings you want to change.

  3. Scroll down to Cache Expiration (TTL).
    The default setting is 2 minutes, but you can choose options from no-cache up to 60 minutes.

  4. Click Save.


Longer cache times are better for performance, but visitors do not see updates you make to the snippet until the cache expires. If you choose 15 minutes or longer, a warning displays that visitors will not see updates until the cache expires, which means that an experiment could still run for up to 60 minutes after you stop it.

Cache Expiration (TTL) for custom snippets

If you link multiple projects to create a custom snippet, Optimizely Web Experimentation enforces the cache TTL you set for the custom snippet over the cache TTLs for the individual projects' snippets.