Since sometimes changes in piwik's js is nessary (fixes and optimizations)
one should made it possible to bring these changes to every visitor especially also to returning visitors as soon as possible (asap = instantly on availibility).
At this time caching of visitor's browser slows usage of new version down
e.g. https://github.com/piwik/piwik/issues/9607#issuecomment-173673850
The problem is that this file is often chached by the browser and reused for some time.
One solution can be an intelligent versioning of this file / the file hirachie construct around.
Everytime there is a change, a recognizable new version is provided and with this loaded and used by the browser.
Some general thoughts about this can be found here
https://stackoverflow.com/questions/8224736/javascript-versioning-to-avoid-caching-difference-in-these-practices
real world example:
fix (partly) of some tracking issues with new hearbeat funcition is done,
but it takes more than a week+ to make visitors use new fixed piwik.js
and all this time a great part of tracked data is still faulty and make bad statistics, even if there was a fix implemented
I think all we can do here is to write an FAQ (if none exists yet) on how to achieve this. It otherwise depends on proper server configuration and integration into the website. We cannot really do much here. However, what we can maybe do would be to add an option to the TrackingCodeGenerator API to add Piwik version string as URL parameter automatically. This way users can still include it in their website by calling the API and benefit of proper versioning :+1:
If someone wants to work on this ping me and I can give some help on which files need to be edited
hmm.. as you know I'm no programmer...
but coudn't one make it somehow that way:
having a file
which is never cached and with this always loaded
but is very very small because it only contains the name information (redirection) to the actual versioned piwik js
which is cached as best/long as possible
but reloaded if it's name has changed (which is know because of the information included in the tiny file)
?
It might be possible but not really fast etc. For best performance you don't really want to have a file that is always loaded. Especially when it comes to tracking as it may take a bit longer to load even if the file is very small and then it might miss to track a user when the user is leaving the page quickly.
Thanks for suggestion. By design we can't easily force clients to re-download our piwik.js. If a Piwik user wanted to do this, the best way would be to configure the webserver to set the appropriate cache headers. I'd recommend to check online for articles that explain this, rather than create a FAQ on our website.
Maybe we could at least have an FAQ that basically says "Google for how to do this" as for sure many users have this question. This is relevant for pretty much every application and enterprise website.
@tsteur we could have such FAQ
Did anything happen?
We would highly appreciate versioning of the matomo container file.
There is a simple solution in the forum (the file cache duration is forced by JavaScript to 1 day):
https://forum.matomo.org/t/tag-manager-container-file-caching/44269/2
There is a simple solution in the forum (the file cache duration is forced by JavaScript to 1 day) ...
Sorry, this is not what I consider decent caching policy.
True versioning would allow to
Since the tag manager already works with versions, I assume that enabling to append of a version string not to be rocket science.
Thus I repeat myself: "We would highly appreciate versioning of the matomo container file."