- Adjust site performance by changing the Optimizely Web Experimentation snippet's cache time
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. Then, they do not need to download anything on the next page they visit.
The benefit of caching is better site performance. The downside is that visitors will not see your latest update if your snippet changes 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, with detailed steps to follow:
Navigate to Settings > Implementation.
Click the name of the snippet whose settings you want to change.
Scroll down to Cache Expiration (TTL).
The default setting is 2 minutes, but you can choose options from no-cache up to 60 minutes.
Longer cache times are better for performance, but visitors will not see updates you make to the snippet until the cache expires. If you choose 15 minutes or longer, you will see a warning 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. In other words, the custom snippet's cache TTL trumps the cache TTLs for the individual projects' snippets.