Matomo for Progressive Web-Apps: measure performance

Hello all,

first a great warm thanks to Matomo. The beast is really nicely handlable and shows useful information, at least once the refresh-rate (aka the archiving data frequency) is minimized.

I have introduced a new site, our dev site, and I have switched to dynamic calls to trackPageView: Every time a panel is loaded, that is a new call. So far so good.

However, I realize that I can’t use the performance tool for this: The performance tool is designed to evaluate dom-load-stages which are not there if the knowledge of the new page is just the end of the process.
(btw: my progressive/SPAs are not necessarily network-less or super fast)

So, as a crutch. I could add some performance measurement of the AJAX-like calls, as a custom dimension and I could have some overall report of these values.

But wouldn’t there be a better practice into being able to send track-events for each of the dom-load-steps that are displayed by the performance tab?
E.g. kicked-request, content-arrived, content-displayed? There must be some place I could call to in the matomo JS to simulate this, or?

After all, the “click, load, finished-load, display” cycle is quite the same in an SPA, a PWA, and a simple page.

thanks in advance.


So… the custom dimension approach is not the ideal thing as the display is only tabular and text based. I had to round values to some segments so that the presentation is understandable. It would be interesting, too, to have custom-dims or -vars that are numeric!

The JS-mentioned page-views which are normal for single page apps (as in the page about Single Page/Progress Web-Application) is missing the answer to my question: there is a method setPagePerformanceTiming that can be used just for that (source here with all parameter types). This is a documentation addition suggestion.

I think I would have found this far easier if I had an access to an object that has the functions explicit as I find them in the Matomo object that is created in my page loads where, among others, the function setPagePerformanceTiming could be found. Maybe an alternative to the Tracker documentation page is available for developers where function names are used instead of _paq.push calls? I understand their need but they really make the documentation difficult to read. This is, also, a documentation suggestion.



Hi @polx
Then, if I understand well, you wold like to track the “page performance” of AJAX calls + DOM update for SPA?
Matomo cannot do this by itself (as it doesn’t know if an AJAX call will “at the end” repaint the page or not…
I think you have to calculate yourself client side all metrics for the 2nd+ page views, and call the page views directly with the low level HTTP API:

The problem with this is you will probably loose the visitor ID + visit ID… Then you’ll have to do this from the 1st page.