microsoft / ApplicationInsights-PHP

Azure Application Insights SDK for PHP
https://azure.microsoft.com/services/application-insights/
Other
108 stars 92 forks source link

How do you get the page loading time? #38

Closed nathanlabrake closed 6 years ago

nathanlabrake commented 6 years ago

Right now when I use the trackPageView() function I'm always getting a page load time of 0 (except when using the fixed number of 256 in the second example). It doesn't make sense to use a fixed number, obviously, since I'm trying to get how long it took the page to load.

Instead of 256 in this example: $telemetryClient->trackPageView('myPageView', 'http://www.foo.com', 256, ['InlineProperty' => 'test_value'], ['duration' => 42.0]);

How do I correctly get the page loading time?

Thanks, Nathan

fadamsen commented 6 years ago

You have to measure it yourself on the client-side in the app/browser. (It is my understanding that the trackPageView method isn't really for server-side use unless you're proxying calls through your server to prevent being blocked by ad blockers etc.)