How To Test Your AdSense Layouts

As anyone who’s tried designing their own website or blog layout, it takes a lot of fiddling with things to get the pages on a new site/blog looking “right”. Adding AdSense to those layouts complicates things even further.

Crawled By AdSense At The Wrong Time

Although I devote a couple of chapters to this topic in Uncommon AdSense, here’s the basic idea when designing new AdSense layouts: you need to keep the AdSense crawler away from your layouts until you’re ready to see some live ads.

The first time an AdSense ad or link unit is displayed on a page that Google’s never seen before — by this I mean that the URL of the page is new, not the content — then the AdSense system displays ads based on what it thinks the page is about based solely on the URL of the page and the content of the other pages on the site. Meanwhile, it dispatches the AdSense crawler (the “Mediabot”) to fetch the contents of the page for analysis. This typically happens within a few seconds of the “first view” of the page.

Here’s the problem, though: you probably don’t want the crawler to analyze the page. Not yet, anyhow — it’s probably full of nonsense or irrelevant content. If it has any content at all! Which means the ads you’ll end up seeing will either be non-existent or poorly-targeted. Not at all what you want. Because once the page has been crawled it will be a while (typically hours, if not days) before the crawler comes back to revisit the page. Oops.

There are two general solutions to avoid this problem.

Solution 1: Use Test Pages

This solution is extremely simple. Put the AdSense code in your layout as usual, but don’t actually display any “real” pages. Only use test pages that won’t be made public. You can do this quite easily by creating a “test” folder on your site and putting your test pages in that folder. Tweak away at your layout until you’re satisfied with the way those pages look, then switch the “real” pages on your site over to that layout.

Solution 2: Don’t Use The AdSense Code

The problem with the first solution is that it isn’t always possible. Or not easy, at any rate. Especially with blogs, where there are fixed URLs that you’ll need to interact with as you tweak things. The solution in this case is to not insert the AdSense code into the layout. Instead, replace them with an equivalently-sized block of HTML.

For example, say you wanted to display a half banner, which is an ad unit that is 234 pixels wide by 60 pixels high. This half-banner has a grey background. An easy way to do this is to use a <div> tag with appropriate style settings:

<div style="width: 234px; height: 60px; background-color: #AAAAAA;">
</div>

This is what you’d see with the code above:

That’s it. You can do this for all your ad and link units. By explicitly specifying width and height you ensure that the other elements in your layout reflect their true positions. When you’re ready to go “live” you just replace the “fake” ads with real AdSense code.

The AdSensePHP Test Mode

To help you deal with this issue, I’ve just updated the AdSensePHP Lite script to include support for “test mode” code generation. It’s on by default, which makes testing simple. The code that gets generated in test mode is similar to what I described above in Solution #2, except that it displays a more AdSense-like “ad” that respects your color scheme choices. See AdSensePHP Test Mode for more details.

Sponsored Link: For a complete set of AdSense best practices, read Uncommon AdSense — for serious AdSense publishers only!

Eric Giguere is the author of Uncommon AdSense and the award-nominated (that just means it lost!) blog Make Easy Money with Google and AdSense.

Comments

3 Responses to “How To Test Your AdSense Layouts”

  1. Technical Itch on June 7th, 2007 1:36 pm

    Thanks for the tip. I’d never thought about this problem before but it makes a lot of sense.

    I will certainly look into using this strategu on my site at some point.

  2. AdSensePHP Test Mode : AdSensePHP on June 20th, 2007 9:23 am

    [...] more information about why you’d want to use AdSensePHP’s test mode, see How Test Your AdSense Layouts. June 7, 2007 | Filed Under [...]

  3. The Post-Installation WordPress Routine : Make Easy Money With Google And AdSense on June 20th, 2007 9:47 am

    [...] You don’t want the ads showing up until you have some real content available — see How To Test Your AdSense Layouts for reasons [...]

Subscribe without commenting