I am stuck in a situation where I am left with no open end on a problem. Let me put the problem first. We are trying to improve the performance of a webpage. We already have GA tracking on it. We fire '_trackPageView' on every page visit and we don't use any 'site speed tracking'. In GA reporting we find the dom load time is around 5s and the page load time is around 13s.
To reduce the page load time, we want to load all the js scripts which are not necessary at load time, asynchronously after page load. But the problem is we are not sure when the '_utm' image beacon (_tackaPageView) is fired. If it is fired only after all the asyn resources are loaded, the page load time will increase further.
So we tried debugging ga.js. _pageTrackView is fired on window onload. After that there are no other GA requests fired. But the one thing which we are not able to figure out is, how GA is able to track the dom load time, page load time etc., There's no such trace in the request. There is one epoch current time stamp, which is stored _utma cookie, for instance '_utma=1.417929071.1376029504.1376029504.1376040649.2'. I learnt that the last but one parameter '1376040649' is the time stamp of when user entered the page in current session. Remaining are all about the first visit, visitor id etc., There a request parameter which has no explanation anywhere 'utmht', for example 'utmht:1376040648577'. '1376040648577' is a timestamp which is equal to the __utma timestamp except for the milliseconds part. Apart from this I don't find any time stamp or anything that is related to time. But GA tracks that all. How? It has become a mystery to us. I tried figuring it out on numerous sources. Not one has any answer or explanation.
Any help would be greatly appreciated.
The page load time is reported to Google Analytics with the trackPageview call. The data is aggregated in Google Analytics and can be viewed in the Visitors > Custom Variables section. We need to export the data into excel to do anything useful with it because Google Analytics isn’t too good at dealing with numerical data in custom variables.
Also, trackPageView () is not sufficient to log page load time. To gather this information, add methods to start and end a custom event, so that every time the user navigates to a new page, the total time can be calculated by App Insights.
In page tracking, a page represents a web page. The page can be a static or dynamic (dynamically created) web page. Through page tracking, you can measure the number of times a page was shown to your website visitors in GA. This can be done by sending a pageview hit, each time a page is shown.
However, by default, GA tracking code is executed only on a page load. If a page does not load in your web browser, then the tracking code is not executed and hence no pageview data is sent to GA server. Get this 70 page detailed checklist containing screenshots, step-by-step instructions and links to articles
Finally found the answer. Posting it as it might help someone else.
_trackPageLoadTime()
is deprecated.
GA does track pageload by default on _pageTrackView
, but not on all requests. It uses sampling rate on client side to send 'pageload timing' information to server. The default rate is 1%. That means for every 100 _pageTrackView
requests, only one time ANOTHER request is sent with all page load information. We can also set the client sampling rate to any value using _gaq.push(['_setSampleRate', '80'])
. When I set the sampling rate to 100, on all the requests, pageload time tracking beacon was also sent. There ends the mystery.
This document might help, especially the notes section at the bottom which could point you in the right direction as to how page timings works.
https://support.google.com/analytics/answer/1205784?hl=en
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With