Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New FAQ: How do I force my website visitors browsers to download the recently updated piwik.js? #9619

Open
hpvd opened this issue Jan 22, 2016 · 11 comments
Labels
c: Website matomo.org For issues related to our matomo.org website. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.

Comments

@hpvd
Copy link

hpvd commented Jan 22, 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. #9607 (comment)

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

@hpvd
Copy link
Author

hpvd commented Jan 26, 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
image

@hpvd hpvd changed the title versioning of piwik.js to bypass user's cache on changes versioning of piwik.js to bypass user's cache on changes -to make fixes used asap Jan 26, 2016
@hpvd hpvd changed the title versioning of piwik.js to bypass user's cache on changes -to make fixes used asap versioning of piwik.js to bypass user's cache on changes - to make fixes beeing used asap Jan 26, 2016
@tsteur
Copy link
Member

tsteur commented Jan 26, 2016

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 👍

@tsteur tsteur added the Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. label Jan 26, 2016
@tsteur
Copy link
Member

tsteur commented Jan 26, 2016

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

@hpvd
Copy link
Author

hpvd commented Jan 26, 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
Copy link
Member

tsteur commented Jan 26, 2016

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
Copy link
Member

mattab commented Jan 26, 2016

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.

@mattab mattab closed this as completed Jan 26, 2016
@mattab mattab added the answered For when a question was asked and we referred to forum or answered it. label Jan 26, 2016
@tsteur
Copy link
Member

tsteur commented Jan 26, 2016

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
Copy link
Member

mattab commented Jan 26, 2016

@tsteur we could have such FAQ

@mattab mattab reopened this Jan 26, 2016
@mattab mattab removed the answered For when a question was asked and we referred to forum or answered it. label Jan 26, 2016
@mattab mattab added the c: Website matomo.org For issues related to our matomo.org website. label Mar 31, 2016
@mattab mattab changed the title versioning of piwik.js to bypass user's cache on changes - to make fixes beeing used asap New FAQ: How do I force my website visitors browsers to download the recently updated piwik.js? Mar 31, 2016
@mattab mattab added this to the Mid term milestone Mar 31, 2016
@fritzgithub
Copy link

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

@heurteph-ei
Copy link

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

@fritzgithub
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Website matomo.org For issues related to our matomo.org website. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Projects
None yet
Development

No branches or pull requests

5 participants