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

Javascript optimization for matomo.js #19541

Open
h3x4git opened this issue Jul 18, 2022 · 4 comments
Open

Javascript optimization for matomo.js #19541

h3x4git opened this issue Jul 18, 2022 · 4 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@h3x4git
Copy link

h3x4git commented Jul 18, 2022

According to PageSpeed Insights the "matomo.js" file that is served onto pages is not well compressed and it would be great if you could please make it smaller.

The test result says that from 62.7KiB it could be reduced up to 37.9KiB.

It would help boost up the PageSpeed ranking a bit

@h3x4git h3x4git added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label Jul 18, 2022
@Findus23
Copy link
Member

In case you are referring to the file compression: This is not something Matomo does, but your web server when delivering static files. So you need to set your web server up so that it gzip-compresses (and optionally brotli-compresses if you like) the matomo.js, which reduces its size by quite a large fraction.

@Findus23 Findus23 added answered For when a question was asked and we referred to forum or answered it. and removed Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. labels Jul 18, 2022
@h3x4git
Copy link
Author

h3x4git commented Jul 18, 2022

I'm mostly referring to the javascript optimization, if it could be minified some more maybe? Google only says "reduce the amount of unused javascript code". The report doesn't mention the gzip compression with regards to matomo.js

@Findus23
Copy link
Member

This is hard to avoid as Matomo can't know which features you don't want to use and splitting up matomo.js is not trivial (#19144).
And if file size is the highest priority and you don't use any non-default Matomo features or cookies, then one can try recreating the core of matomo.js in less than 1KB like I tried out in https://github.com/Findus23/MatomoLiteTracker

@h3x4git
Copy link
Author

h3x4git commented Jul 18, 2022

Thank you for suggesting MatomoLiteTracker, it's interesting.

I personally find that 35KiB+ is nothing to worry about but I use Matomo in basically any website and that file always appears in the list of problems with PageSpeed Insights so I thought I would open an issue to just let you know.

It's definitely not going to be a life-changing improvement to any ranking, but still noteworthy for some websites

@justinvelluppillai justinvelluppillai added this to the For Prioritization milestone Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

3 participants