7 ms·
That's pretty cool, though the biggest slowdown for most sites are all of the third-party scripts being loaded from remote servers. If people really realized h
by jellicle 16y ago
That's pretty cool, though the biggest slowdown for most sites are all of the third-party scripts being loaded from remote servers. If people really realized how much page speed matters in usability, they would be loathe to add in all the scripts from facebook and digg and google and 12 different analytics services.
- user24 16y agoaddthis is a particularly guilty culprit. pageSpeed is always giving me hassle about their CSS. grumpywebmaster. You listening addthis?
- al_james 16y agoAd networks are a particular culprit. For many (banner) ad networks, HTTP requests get bounced around so many servers that it can really slow things down.
- SanjayUttam 16y agoMight be obvious, but this is why you should use some asynchronous code to load your ads.
- tropin 16y agoCould you please give us some links or info on loading the ads asynchronously? Is it compatible with Adsense policy?
- SanjayUttam 16y agoHere are some links. I don't have a rock solid answer regarding Google's TOS for this, my apologies. Async Adsense: http://webmasters.stackexchange.com/questions/2506/is-it-possible-to-use-asynchronous-google-adsense-i-e-non-blocking http://webmasters.stackexchange.com/questions/2506/is-it-pos... Async Analytics: http://www.ditii.com/2009/12/01/google-analytics-asynchronous-tracking-code-snippet-launched/ http://www.ditii.com/2009/12/01/google-analytics-asynchronou...
- tropin 16y agoFrom the first link: "this practice might not be welcome by Google". I don't know what's the second link for, as analytics are asynchronous per se? EDIT: By the date on the second url, very probably is a hack for an older version of Analytics. EDIT 2: First link is an unaccepted answer on an stackoverflow-like site on the topic for using an against the rules of Google hack. And Google doesn't need much help for closing your account and your money.
- SanjayUttam 16y agoRe: Analytics; I'm not sure if the default code google gives you for analytics is async _now_ but based on this http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html http://code.google.com/apis/analytics/docs/tracking/asyncTra... it certainly seems like it, at least at one point, it was not. Again, that may have changed. Here is another link for async adsense with code included. The author has also posted his e-mail conversation with a rep. from the Google Adsense team. There is nothing fancy going on here, just iframes, really. http://geoland.org/2007/01/adsense-in-iframe/ http://geoland.org/2007/01/adsense-in-iframe/ You could just reach out to adsense yourself and report back what you find regarding violation of the Google Adsense TOS.
- al_james 16y agoNot always possible with all banner networks I am afraid!
- pjscott 16y agoThose banner networks deserve to lose customers to the banner networks that do support asynchronous loading. Does anybody have a list of which banner networks allow it and which don't?
- wanderr 16y agoIt is if you stick their ads in an iframe, ala Grooveshark.
- al_james 16y agoNot if they are contextual and demand the host script to be in the top level document. (and this is against the terms of use of many advertising services)
- joshfraser 16y agoyou lose ad revenue if you do that. the longer it takes the ad to show up on the page, the less likely people are to click on it.
- yellowbkpk 16y agoThe longer it takes me to load your page, the less likely I will ever see it (because I back out to my previous page) or will ever come back to it (because of the bad experience).
- cheald 16y agoGoogle Ad Manager -really- does not like you doing anything asynchronously, unfortunately.
- al_james 16y agoYeah, its because many of the ad networks that you may load into it simply cannot work asynchronously (document.write). So they have to enforce synchronous loading on the ad manger code.
- mise 16y agoIf someone knows how to do with with OpenX, let me know. I've read using iFrames is a solution, but don't know the disadvantages to this.
- catshirt 16y agoYou're right, but seems irrelevant. mod_pagespeed likely has a very different audience.
- tropin 16y agoMy adsense scripts almost always freeze my webs waiting for them to load. Do you fellow HNers know any way to speed up them or at least load them in the background?
- metachris 16y agoYou could inject the analytic script after the page has loaded instead of having it part of it.
- tropin 16y agoI'm talking about ads, not analytics.
- aiurtourist 16y agoIt's been a while, but I think you can choose between IFRAME and DOM-injection methods. Researching that might get you started.
- asolove 16y agoPut script tags at the end of the body, not in the header. If you still have a problem, dynamically add the script tags after the page has already loaded and displayed.
- tropin 16y ago??? Could you share any sample of adsense with scripts in the header? Also, do you know any way to load dynamically the scripts? Google seems to be full of people trying to do it to no avail.
- bentlegen 16y agoGoogle's asynchronous tracking snippet: http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html http://code.google.com/apis/analytics/docs/tracking/asyncTra...