- Adjust site performance by changing the 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 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, on the next page they visit, they don't need to download anything.
The benefit of caching is better site performance. The downside is that if your snippet changes, visitors won't see your latest update because they're running the older cached copy of your site.
To compromise, Optimizely privacy settings for web projects 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's 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 won't see updates you make to the snippet until the cache expires. If you choose 15 minutes or longer, you'll see a warning that visitors won't see updates until 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 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.