How long will the container JavaScript files be cached for in visitors’ browsers? (js/container_*.js files)
When you use Matomo Tag Manager and people visit your website, each visitor’s browser will download the « JavaScript container file » from Matomo. This container file name looks like analytics.example.com/js/container_*******.js
. This file includes the Tag Manager JavaScript logic as well as your container’s logic (tags, triggers, etc.). The browser will transfer the file and the size would typically between 20kb and 70kb compressed (gzip).
This static JavaScript file will be cached in the browser for a certain duration.
How long will the container_*.js file be cached for?
-
If you’re using Matomo Self-Hosted, the cache duration depends on how your web server (hosting Matomo) is configured. See below for how to check the current value in your web server.
-
If you’re using the Matomo Cloud service, then the container files are cached for 8 days on visitors browsers.
This means that after you make a change to the container, it will take up to 8 days for the file to refresh in returning visitors’ browsers.
Checking how long your container files are cached for
You can manually check how long the container files are cached for, by using the Developer Tools panel in your browser, and going to the « Network » panel, and searching for « container ». You can then click on the container_*******.js file, and check the « Cache-control » header (where the value is the file cache duration in seconds).
For example on Firefox here is what it looks like on a Matomo instance where the cache is set to 8 days: