On this page

Web Experiment performance

Web Experiment intentionally minimizes its impact on page performance.

Script size

The Web Experiment script is dynamic and includes all your experiment configurations to avoid multiple synchronous downloads. Script size starts at a base size and scales with each experiment.

To avoid constantly increasing script sizes, deactivate or archive experiments when they're complete.

Custom code impact on flag size

Custom code increases a flag's code size by the size of the custom code itself.

Caching

Web Experiment uses two caching layers: CDN and browser. The two layers make script delivery to your site more reliable.

CDN cache

Amplitude caches the Web Experiment script on a CDN. When a user requests the script, the browser loads the script from the CDN if another user loaded it in the same geographic area. The CDN cache has a max age of one minute and serves stale content for up to one hour while the script reloads. If the origin returns an error, the CDN serves a stale response for the maximum time possible.

The cache control response header that configures CDN caching is:

max-age=60,stale-while-revalidate=3600,stale-if-error=31536000

Browser cache

The browser cache serves the Web Experiment script without a network request for 60 seconds, or for the maximum time if the server returns an error. The browser cache serves the script from memory (0ms latency) when a user loads multiple pages on your site, or reloads the same page within a one-minute window.

The cache control response header that configures browser caching is:

max-age=60,stale-while-revalidate=3600

Evaluation

Web Experiment evaluation runs locally using information available synchronously in the browser. Evaluation is CPU bound and usually takes less than 1ms to apply variant actions.

Ad blockers

Amplitude can't identify users with ad blocking software enabled. Those users don't log assignment events or impressions, and don't experience the experiment.

Was this helpful?