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 <
- > by >
- 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
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.
Nice tool to convert adsense codes but I use offline application to do this task.
Thanks for feedback :)
Till now, I had to convert the code manually. But thanks to you for introducing a nice tool.
I’m glad it helped. Thanks for feedback :)
wow, thanks a million! this tool is very useful!
thanks :)
waa nice tool..thanks dude
woow! wonderfull thank youu…
thanks for helping me converting my adsense code. you have make my job much easier. btw, where you get the script of the converter?
@Duncan33
I wrote this script myself.
thanks! i searched for a long time…
Wow! This tool is really cool.
Well this is really a useful tool
thanks for sharing.
take care.
Thanks What a nice tool Every time i need to convert i always do it here pretty easy here
thanks friend this tool is very useful
It doesn’t work when I paste it directly into the add HTML gadget. It works when I put it directly into the template, any ideas?
@Dan
Directly paste the code you have in HTML gadget. No need to convert it. The converter is useful only if you want to use the code in template file.