Open rr-it opened 1 year ago
Hi @rr-it, thank you for the creating the issue and explaining your idea for improvement, it definitely sounds interesting. As I'm not personally sure how this could be implemented I'm assigning the issue to the product team to have a look and prioritise it.
Summary
The PagePerformance Plugin can already track
time_on_load
via JavaScriptPerformanceTiming.loadEventStart
/PerformanceTiming.loadEventEnd
.In case
trackPageView
is fired on eventDOMContentLoaded
and thereby before the eventonload
:time_on_load
is always0
.Can we implement a solution to still track the pageview on event
DOMContentLoaded
and updatetime_on_load
later on?Generally tracking the pageview after the event
onload
might not work, as we are losing tracked visits which did not wait foronload
to finish.This feature would open further performance tracking options. E.g. track a new metric
time_fully_loaded
- after all ressources on page are fully loaded:Update the data once before page is closed: See mdn web docs: Navigator: sendBeacon() method - Sending analytics at the end of a session