Adsense Code Converter For Blogger Blogs

I was recently developing a blogger blog template for a client and I faced a strange problem. Whenever I tried to insert adsense code directly into the blogger template,

  • Either it would not show up at all,
  • Or an XML not well formed error messages, like the following, were displayed.

“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.”

“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 “[pP][qQ][rR]” is not allowed.”

I thought that this may be an issue with the adsense code. So, I tried AdBrite and Chitika codes as well. They didn’t show up either.

I thought that may be if I make sure that the XML is well formed, the ads will start showing. But blogger probably allows the javascript code without parsing it, and then causing strange behavior later.

Then I converted all the special characters in the javascript into HTML entities. For instance, I replaced

  • < by &lt;
  • > by &gt;
  • and so on.

The converted code worked perfectly fine with the blogger template. I inserted it in various positions, including the main content area and the sidebar, and it worked each time.

So, finally the solution to this issue is to replace certain characters like <, > etc. to their respective HTML entities. Now, it took me a lot of time to convert the adsense code to this working format. So I created this tool.

Adsense Code Coverter For Blogger Blogs

adsense-code-converter-for-blogger-blogs

What is Adsense Code Converter For Blogger Blogs

It is a tool to encode HTML and JavaScript advertisement codes into strict XHTML entities. As I mentioned above, if you directly use ad codes in blogger template, it will not work. But once you convert it to XHTML entities using this tool, it can be embedded anywhere in the blogger template.

Note – Please note that you should always backup your blogger template before making any changes to it.

Can it convert Adbrite’s ad code?

You can use this ads code convert to convert any kind of JavaScript ad code. It can be Adsense, Chitika, Adbrite or any other vendor’s code.

If I use this, will I break any AdSense program policies?

No. Using this tool doesn’t breaks AdSense program policies because you are NOT modifying the ad code in any way. To be sure, use the encoded code in your template and then view source of the page. You’ll find no change in the ad code.

You can access this tool here.

Please leave your suggestions and feedback using the comments.