@hpvd opened this Issue on January 22nd 2016

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

@hpvd commented on January 26th 2016

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

@tsteur commented on January 26th 2016 Member

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:

@tsteur commented on January 26th 2016 Member

If someone wants to work on this ping me and I can give some help on which files need to be edited

@hpvd commented on January 26th 2016

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)

@tsteur commented on January 26th 2016 Member

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.

@mattab commented on January 26th 2016 Member

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.

@tsteur commented on January 26th 2016 Member

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.

@mattab commented on January 26th 2016 Member

@tsteur we could have such FAQ

@fritzgithub commented on December 16th 2022

Did anything happen?
We would highly appreciate versioning of the matomo container file.

@heurteph-ei commented on December 19th 2022

There is a simple solution in the forum (the file cache duration is forced by JavaScript to 1 day):

@fritzgithub commented on December 20th 2022

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

  • always and immediately receiving the latest matomo container script (and thus immediatly fresh data)
  • and setting cache period to e.g. one year in order to almost never force recurring user to ask for and download an unchanges resource

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."

Powered by GitHub Issue Mirror