Adsense slow fix
Please use this Adsense slow fix at your own risk.
I still am using this fix for slow Adsense ads. My Adsense ads are working well as of 12/7/2004 (and 1/15/04) using this technique but there could still be problems. Google's adsense help talks about working with frames being a special case; here's a link: Google Adsense Support Help "Framed Page".
You'll probably need an Adsense account to see this link. I'll be
emailing Adsense for clarifications and post information on the Adsense slow status page. Another pertinent link: Why am I getting PSA's?
Of course this page is a test case, it was written after the enhancement and actually the ads seem more relevant than many historically on my other pages.
I've been forced to remove this fix as of 9/5/2005. It worked very well for a full year! Please see the status page
Please see my fix slow Adsense status page.
The fix continued
I've been trying to optimize my website's page load times. One issue I've had is the load time of the Google Adsense advertisements. I've found at times ads from Adsense can be slow. These ads execute a javascript which allows the Google Adsense team to pretty much do anything
with your website that they wish to. I wanted to improve performance of my pages and take control to a limited extent of the effects Google's Adsense might have on my site's performance, and more importantly, its appearance. I'm fortunate to say I've had some very good success in
achieving these goals! I've noticed others having the same problem I've investigated here, and I believe resolved, so please benefit from this information.
Webmasterworld Adsense slow 11/11/2004
I believe you can easily shave 2 or 3 seconds of your page load times if you use this fix. Be forewarned your page content may display well before the Google Adsense ads with this change. For some this is a good thing, others may think it's a bad thing. In the future, I'll be
writing another article about how you could gain more page load speed and have some control over when the Adsense ads load, so please bookmark this page and stop back.
If you implement this slow fix for Adsense ads, I think you'll be pleasantly surprised with your page load time improvement!
The Adsense ads
As you can see to the left I have used a 150 X 600 skyscraper Google Adsense ad on most of my pages. One of the first things I've noticed about some affiliate ads is they actually place "Cookies" on your computer. I'm a little surprised they do this without a click. Also I believe the action of placing a Cookie on your PC blocks the rendering of a given webpage until the Cookie placement
process is completed. The ads are implemented by a javascript which of course your web browser must download before it can execute.
An obvious first attempt to fix the slow Adsense ads
At first I moved the Adsense ads to the right side of my page. Had you looked at the HTML source code ("right click", "view source") you would have seen that the entire page (excluding the bottom) should have been loaded before the Adsense ad. But that's not what
happened. I even used a
position box 120 x 600 so the browser will know how much pixel space to reserve for the "slow" Adsense ads. This didn't help page load time either.
What's the key to the Adsense slow fix ?
This fix can really help your page loading speed in many ways, not just for slow ads from
Adsense. The trick is to use an "IFrame" HTML directive. Inline Frame syntax at W3C W3C -> IFrames.
Talk about killing two birds with one stone, IFrames are great. WHY you say?
An IFrame lets you insert a new web page in your current web page. And importantly you can absolutely control the size of this new page or window in your currently displayed page. But most importantly your web page rendering does not have to wait for the IFrame's web page
rendering. Your browser knows the maximum size of what will be rendered in the IFrame so your browser can continue to render your web page content and then finish off the IFrame content later. The works really well for those affiliate advertisements that can be even slower the Google's
Adsense.
Note: I soon hope to have another article about another optimization that can enhance page load performance even more, please check back, I'll post a link here.
Also an article on how to fix Adsense relevance problems.
An easy implementation of the fix for slow Adsense ads
First create a blank page, perhaps including just your background color or image. Make this page a hidden page with no navigation on it or to it. On this page insert your Google Adsense HTML, that you found at the Adsense site. For this code I did not set the "Frames"
check box.
Sample Adsense HTML
<script type="text/javascript"><!--
google_ad_client = "pub-1627630999851968";
google_alternate_ad_url = "http://www.bobshowto.com/XXXYYYZZZ.htm";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_channel ="9850290606";
google_ad_type = "text";
google_color_border = ["336699","E0FFE3","DFF2FD","FDFFCA"];
google_color_bg = ["FFFFFF","E0FFE3","DFF2FD","FDFFCA"];
google_color_link = ["0000FF","0000CC","0000CC","0000CC"];
google_color_url = "008000";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Hopefully you've seen this code before, if not you may want to use Adsense for a while before playing with this slow fix enhancement. Again the code above is the only thing on this new, preferably hidden, page. I also use an alternate ad with
Adsense, but in the example I've
eliminated the path to the specific hidden page. There probably is a way to implement this without a hidden page as well, if, you were going for screaming performance.
Here is the new IFrame code that will show your Google Adsense ad
<iframe
name="Adsense120x600"
width="120"
height="600"
frameborder="0"
src="hidden-path/adsense-iframe120x600.htm"
marginwidth="0"
marginheight="0"
vspace="0"
hspace="0"
allowtransparency="true"
scrolling="no"
>
</iframe>
Notice the dimensions of the IFrame are the same as the Google ad. Technically your new hidden page does not even need a background or even background color, but you might want to at least make the background color match your normal background in case Adsense really goes down. Also
note the "src=" parameter points to your new hidden page that simply contains the Adsense code. You have not modified the Adsense code in any way still meeting the Adsense
TOS.
One thing to be aware of.
This is probably not a problem with the Adsense code, but you do want to control how a Hyperlink inside your new IFrame opens another web page. If you're not careful you'll end up with a web page truncated inside your
IFrame! A parameter can be added to the HTML code for your new
Hyperlink. The parameter is [target="_blank"], this is tacked onto the end of your HTML href code. Sample HTML
href:
<a href="http://www.bobshowto.com" target="_blank"> </a>
The link above will open in a new window. There are several alternative parameters. Don't do this for your Adsense ads though, Adsense addresses this problem itself.
If your using Front Page you can set a parameter in the page properties of your new hidden page containing the Adsense code. The property is "Default Target Frame". Even though it is grayed out you can still set it. I'll leave it to you to play with this. With
Adsense it probably won't make a difference.
Web site statistics
Unfortunately some website statistics packages count the display of an IFrame as a Page View. So if you have two IFrames in your web page, your statistics may show 3 page views even though your visitor only actually looked at your one page with two frames.
I hope this helps your site performance and reliability.
Thanks,
Bob
A Hyperlink to this article
To link to this article please just "drag" the link onto your webpage or copy the HTML code.
Link: Adsense slow fix
Code: <a href="http://www.bobshowto.com/Adsense-Slow-fix.htm">Adsense slow fix</a>
A UBB link for use with forum posts, where allowed:
UBB Link: Adsense slow link
UBB Code: [url=http://www.bobshowto.com/Adsense-Slow-fix.htm]Adsense slow fix[/url]
Pertinent Forums:
Webmasterworld -> Adsense forum
Cre8asiteforums -> Google
Sitepoint.com -> Advertising forum
Adsense Code test below. The top left Adsense adds are enclosed in an IFrame
(which used to work). The framed page is adsense-iframe-left.htm This is a test for
Ad relevance in an IFrame. Below the one Adsense ad is not in a frame. The two
are provided for comparison purposes. This page has become an ongoing test page.
Topic: Fix, Slow, Adsense
|