February 8, 20188 yr I recently came across the perfecting feature: <link rel="dns-prefetch" href="//google-analytics.com"> <link rel="dns-prefetch" href="//www.google-analytics.com"> My take on this is that the above example would force Google Analytics to load up last, but does this really help? Where in the headers would the Prefetching need to go to be of some use?
February 9, 20188 yr They need to go inside your <head> before any of the third-parties are called. They basically resolve the DNS ahead of time, so that you don't have to wait for the DNS to resolve when you get to the external resource. This generally means the script is ready to be fetched once the browser gets to it, rather than having to sit there waiting. It still has to fetch the data, but it has already verified the DNS at this point and can get straight to doing that. If you have 5 third-party scripts, 5 DNS lookups have to occur, and rendering will be blocked in the meantime. You can't be certain of how long this process will take either. This tag won't control the loading of assets in the case you've mentioning above, it's not a queueing system, it's just a way to tell the browser what to expect before it gets to it.
February 9, 20188 yr Author 1 hour ago, Jack said: This tag won't control the loading of assets in the case you've mentioning above, it's not a queueing system, it's just a way to tell the browser what to expect before it gets to it. Is it worth having for something like Google Analytics, or is it not going to make any real difference?
February 9, 20188 yr It's not going to make any real difference. Or you could use an altrernate analytics pacakage - one that load's in the footer not the header. My vote goes for http://clicky.com/ It's a much better package than GA.
February 10, 20188 yr 13 hours ago, fisicx said: It's not going to make any real difference. Or you could use an altrernate analytics pacakage - one that load's in the footer not the header. My vote goes for http://clicky.com/ It's a much better package than GA. I could be mistaken as I've not used GA in ages but I'd be pretty sure that it will load async so it doesn't really matter if it goes in the header or the footer in this case.
February 10, 20188 yr You can put GA in the footer but you may not track all visitors correctly if you do. Google explicitly says to add it to just before the closing </head>
February 11, 20188 yr On 10/02/2018 at 10:44 AM, fisicx said: You can put GA in the footer but you may not track all visitors correctly if you do. Google explicitly says to add it to just before the closing </head> What I am saying is that the vast bulk of it's assets will be fetched asynchronously so it's not like you are blocking the browser by putting a large script in the head. If anybody has performance reservations they should be tested. Putting scripts in the head does not always cause browser rendering to be blocked like the old days. Edited February 11, 20188 yr by rbrtsmith
Create an account or sign in to comment