Reputation: 8471
I'd like to track the total bytes transferred, and total requests, to render a page in javascript. I want to collect these numbers from real users "in the wild" to use them for performance monitoring and reporting, so tools like YSlow or Chrome's dev tools aren't appropriate for this application.
Is there a "known good" way to collect this data in javascript? I realize there might be restrictions (for instance, any information about the data transferred by an iframe on a different domain will be opaque); I can live with that.
Upvotes: 2
Views: 2108
Reputation: 664307
You are looking for the browser's Performance
API which was created to do exactly the things you're interested in.
Specifically, you will be able to get a PerformanceResourceTiming
object for every fetched resource, which also includes the number of transferred bytes.
Upvotes: 1
Reputation: 663
If you want to trace the no of ajax request you can use ajaxStart ,but for other request image etc there is no proper api in JavaScript,you can use Browser extension to detect it but it is difficult for web application
Google is developing octane and some other performance tool available but it will not detect the no of request
Upvotes: 0