donni106 / matomo-tracker-react-native

Stand alone library for using Matomo tracking in React Native and Expo projects.
MIT License
46 stars 15 forks source link

Page performance #14

Open uzun0ff opened 1 year ago

uzun0ff commented 1 year ago

Is your feature request related to a problem? Please describe. There isn't a good way to report page performance data.

Describe alternatives you've considered Sending custom data like an optional parameter works, but it feels like you're not supposed to extract response times manually.

Additional context

Screenshot 2022-12-13 at 11 48 03
donni106 commented 1 year ago

Ok let me understand this.

I found some documentation about page performances here: https://matomo.org/faq/how-to/how-do-i-see-page-performance-reports

In the API there is a section called "optional page performance info" here: https://developer.matomo.org/api-reference/tracking-api#optional-page-performancehttpsmatomoorgfaqhow-tohow-do-i-see-page-performance-reports-info

This means, it should be possible by gaining several values and post them to Matomo, right? So the main question is, how to obtain these values!? I don't know about it. Maybe there are browser APIs that are accessible for these cases?

angelxmoreno commented 10 months ago

@uzun0ff where you able to resolved this?

uzun0ff commented 10 months ago

@uzun0ff where you able to resolved this?

Unfortunately, I had no success 😕

angelxmoreno commented 10 months ago

@uzun0ff @donni106 I think the first issue here is how to gather performance metrics from react native.

I know of a few tools, Flipper being one of them, but that only works locally.

donni106 commented 10 months ago

First let's talk about how to translate the page performance metrics of Matomo to native apps theoretically, right?!

For pageviews the following page performance metrics can be tracked:

pf_net — Network time. How long it took to connect to server.
pf_srv — Server time. How long it took the server to generate page.
pf_tfr — Transfer time. How long it takes the browser to download the response from the server
pf_dm1 — Dom processing time. How long the browser spends loading the webpage after the response was fully received until the user can start interacting with it.
pf_dm2 — Dom completion time. How long it takes for the browser to load media and execute any Javascript code listening for the DOMContentLoaded event.
pf_onl — Onload time. How long it takes the browser to execute Javascript code waiting for the window.load event.

All page performance metrics expect a value in milliseconds.

For screens in native apps we have either a subset of these metrics or different meanings.