I am a 3x Entrepreneurs. Love writing code and sharing what I learn everyday as a programmer and an entrepreneur.

June 10, 2008

How to Embed Ad Code Anywhere in Your Blogger Template

Have you ever tried to insert javascript ad code directly into your Blogger Template and it just wouldn’t work? Ok, everyone in the room can put their hands down now. This has always been a huge problem for blog authors using Google Blogger looking to monetize their site since almost all ad code contains javascript.

So why is this so darn difficult to do? The problem in the past was that Blogger users wanted more control over where and how frequently their block of ad code (usually AdSense) appeared. The Blogger Team listened to their customers and created an easy to use feature that allows you to setup AdSense in your individual posts with a simple checkbox selection.

Typical Blogger Error Messages

That’s great for most people but the places where you can insert widgets are rather limited and not as flexible as you’d like. So what if you want to put AdSense, AdBrite, Chitika or any other sort of javascript-related code elsewhere on your blog without having to use a widget? The answer in the past would be, “It’s just not easy”.

You would paste the Google AdSense, AdBrite, Chitika or any other javascript ad code into your xml Blogger template only do get an error like:

Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly. XML error message: The processing instruction target matching “[xX][mM][lL]” is not allowed.

or another really cryptic error message like:

Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly. XML error message: The content of elements must consist of well-formed character data or markup.“.

In fact, more recently the Blogger xml parser seems to allow javascript code in your template without displaying an error message at all. You think all is well only to discover when you view your blog that nothing actually gets displayed. Grrr.

So here is the solution ,parse your code according to xml .To get your Adsense code parsed/changed according to Blogger ,paste the Adsense code or whatever adservice you using code here in this below given box and press enter.
And copy the code you will get and paste it anywhere in the HTML Of your blogger template it will run:)

Paste Ad Code to Convert Here:




Thanks to www.eblogtemplates.com

1 comment: