Thursday, February 4, 2010

AdSense Troubleshooting: Extra line breaks

This article is about fixing problems with AdSense advertisements that are caused by having extra line-breaks in the ad-code.

Putting AdSense ads into your posts - what can go wrong

Battle of the Canal du Nord - Horse drawn artillery wagonPreviously I've explained how to set up AdSense for your blog, and how to put AdSense advertisements
right inside a post rather than in the header, footer or sidebar.

However AdSense ad code won't work if it has any extra line breaks added to it.  This is why, to put it  you need to paste the code into the editor in Edit HTML mode, not Compose mode.   And to be certain, I also recommend that you make sure the "use <br /> tags" option (previously called "Ignore new lines") is chosen as well.

If you don't do this, ie if you put the code into the Post Editor while you are in Compose mode, Blogger seems to insert extra <br /> tags (ie new lines) in places.  And this causes the ad to not be displayed.

Fixing the problem

If you encounter this problem while putting ad-code into a post in this way, it's best to go in to Edit HTML mode and:
  • remove the whole piece of Ad code
  • in a separate window, log into AdSense (, choose the Ad you want from  from Adsense Setup / Manage Ads
  • copy the ad code
  • swtich back to your blogger window and paste the ad-unit in again
Removing the line-break characters by hand is tedious to do, and I've found it's very hard to get right.

Related Articles

AdSense Troublehooting hints-and-tips

Putting AdSense ads inside blog posts

The Post Editor's  <br /> tags vs new-line option.

Share this Article


HTML link code:

BB (forum) link code:

Subscribe to Blogger-hints-and-tips

FeedBurner will send a confirmation message. Click the verify link in it to start your subscription.

Follow Me on Pinterest Subscribe to Blogger-HAT on Google + RSS subscription icon Follow BloggerHAT on Twitter

No comments:

Post a Comment