Trick to Add AdSense, AdBrite and Other JavaScript Ad Code Directly to Blogger HTML Template

Advanced users of Blogger.com service may have tried to insert and put Google AdSense ad code which is actually a Java script directly into the blog pages by manually editing the XML-based template HTML coding interface. Actually, it’s possible add any ad code by using HTML/JavaScript page element within the Blogger new XML template system, but the place where you can place the new block is rather limited, i.e. above or below the post body, header, footer, within sidebar or between blog posts. In case you want to put the ads inside the post, or align the ads to float and wrap around the text, or just within the single individual article content view, you will have to edit directly the HTML coding of Blogger template.

If you try to insert any Google AdSense, AdBrite, AdEngage and any other JavaScript based ad code, or client-side components such as counter, tracker, form, snippet, effect, date and time, etc which is JavaScript based, the following error message may be returned when saving ore previewing:

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

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 reference to entity “zs” must end with the ‘;’ delimiter.

and many other different XML error message.

The problem is caused by incorrect dynamic interpretation of Blogger XML template when it generates the HTML webpage for the blog page that is requested, probably due to the fact that the AdSense ad code or other code is not a valid XML, coupled with the fact that some ASCII characters have special meaning and reserved functions, confusing Blogger blogging engin.

The resolution to the JavaScript based coding does not work in Blogger HTML template error can be solved by replacing special characters or symbols in the script to HTML code. Check out the list below for which ASCII characters that need to be replaced with their corresponding HTML code. Using HTML code will ensure that Blogger render the character correctly when serving the page to the viewer.

< - &lt;
> - &gt;

Above two is enough to make Google AdSense works in Blogger template. For other scripts, such as AdBrite ad code, you will need to replace more characters such as those listed below.

& = &amp;
” = &quot;

For example, a Google AdSense code should become looks similar to code below:

&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-XXXXXXXXXXXXXXX";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "000000";
google_color_text = "000000";
google_color_url = "000000";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;

While an AdBrite ad code will became the similar code to the below:

&lt;script type="text/javascript"&gt;
var AdBrite_Title_Color = '0000FF';
var AdBrite_Text_Color = '000000';
var AdBrite_Background_Color = 'FFFFFF';
var AdBrite_Border_Color = 'FFFFFF';
&lt;/script&gt;
&lt;script src="http://ads.adbrite.com/mb/text_group.php?sid=303771&amp;zs=3330305f323530" type="text/javascript"&gt;&lt;/script&gt;
<div><a target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=303771&amp;afsid=1" style="font-weight:bold;font-family:Arial;font-size:13px;">Your Ad Here</a></div>

Simply use the text editor to parse the code and then replace the characters. Don’t worry about violating AdSense TOS or other terms and conditions, as once the blog’s web pages are rendered and presented to the viewers and visitors, the code will be exactly same as the original code before any replacement!

Share and contribute or get technical support and help at My Digital Life Forums.



30 Responses to “Trick to Add AdSense, AdBrite and Other JavaScript Ad Code Directly to Blogger HTML Template”

Pages: [2] 1 » Show All

  1. Aman
    September 19th, 2008 20:33
    30

    changing “” to &lt & &gt. is it against adsense TOS?

  2. watch tv show episodes online
    September 19th, 2008 02:20
    29

    Hi there, I found the above post very useful and I put adsense code within every post on my blog. This is very cool. I definitely recommend people who haven’t done this to try it because you will earn more. I have another question–do you have any advice for putting ebay affiliate rss feeds inside posts. I want to do it manually so that the feeds are relevant and correspond to what each particular post is about. And I only want a few posts to have the links. Do you know of any way to “parse” javascript so it can be read in a blogspot post?

    Thanks!!

    Chris

  3. Freeware symbian java downloads
    August 23rd, 2008 14:18
    28

    Thanks for great tips.I am not sure about what you said for violation of adsense TOS.Are you sure its ok?

  4. mobile
    August 8th, 2008 00:47
    27

    thanks.. was stuck with adbrite code…

  5. Make Money from Blogs » Blog Archive » How to parse Adsense code to add within the Blogger template
    May 28th, 2008 11:08
    26

    [...] adsense code in greater clarity, explaining the need of why this change needs to be done. Read this article (link) for more details: If you try to insert any Google AdSense, AdBrite, AdEngage and any other JavaScript based ad [...]

Pages: [2] 1 » Show All

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting


Custom Search

New Articles

Incoming Search Terms for the Article

adding adbrite to blogspot - adbrite blogger - google adsense javascript - adsense javascript - The processing instruction target matching "[xX][mM][lL]" is not allowed - javascript adsense - adbrite blogspot - The processing instruction target matching "[xX][mM][lL]" is not allowed. - adbrite hack - javascript blogger post - how to integrate AdBrite code into my blog - adbrite on blogger - blogger template javascript - to add adsense script to blogger - free java script for blogger - html ads sample code - add adsense to blogger template - adbrite trick - add javascript blogger template - ads html code - ads by google html code - blogspot html code - how to add Ads from adbrite - parsed ads - The processing instruction target matching "[xX][mM][lL]" is not allowed. - google ads html code - inline java script advert - insert javascript in div IE7 adsense - The processing instruction target matching - how to add adbrite code in my blog - javascript blogspot - where to place adbrite code in blogspot - adbrite entity zs must end with delimiter - add adsense in post - parse adbrite code - putting adbrite ads on blogger - parse Google adsense ke script blogspot - adbrite adsense - how to put adbrite ads on blogger - javascript ad for make money - javascript Blogger - adbrite full page ads html code doesn't work blogger - adding HTML code into page - google adsense target ads code - how to add adbrite to website - insert adbrite in blogger posts - Javascript for Blogger - ad codes html code - google_ad_format = google video adds coding - ad adbrite to blogger -