CoreJs too big, how to reduce javascript for realmap widget?

Hi there,

i’m using Matomo (former Piwik) for quite some time now and i’m interested on how to reduce the CoreJs.
I`m using realmap widget to show website visitors on the main page, but the JavaScript execution time and size is quite big (528KiB), by this having a 1.9+ seconds on pagespeed load.
Is there a way to define custom javascript for the visitors realmap widget and remove unnecessary script?

URL Transfer Size Potential Savings
. 528.5 KiB 420.8 KiB

Thanks for your time.



I can’t think of a way to do this without writing a bunch of custom (plugin) code that changes the template of the Widget to instead of embedding the CoreJS only uses the few scripts that are needed to display the widget without errors.


When looking closer into this, I am not too sure if this would be spending a large amount of effort for not that much of a gain.

If one enables disable_merged_assets=1 in development mode, one can see how every JS file loads not merged.
And sorting the requests on the realtime map widget by transfer size, shows the following:

By far the most size is not by some random JS files not needed for the map (like qrcode.min.js), but for general frameworks (like angular or jquery) or things needed specifically to display the map.

So I am not too sure if changing anything there would be a dramatic page load speedup.
So I would more recommend you to first try more easy to solve things like:

  • gzip SVG files: The map .svg files are quite large and setting your web server up to also compress them will cut their size in half
  • enable caching: Make sure your webserver serves all JS/CSS files with the correct headers so that the browsers cache them and you don’t really have to worry about all of that after the first time loading the map
1 Like