Custom Search
Ads by VADpay advertising

Google Adsense for Vietnames Headline Animator

Tuesday, September 9, 2008

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

Thanks for visiting my blog. Please leave your valuable comments for this post. If you would like to read my new posts via your email, please click on Subscribe to register. Thanks also for your rating. To know more information, please visit links below:

I have at least once a problem with adding the code from Google AdSense, AdBrite, Amazon Associtates,...However I can find the solution when I read the post of Mydigitallife. Following I shall share to you this post. Vietnameses can visit here to read.

Note: In my post, I show you how to translate a Html code to a Xhtml code using a tool from Eblogtemplates: Blogger Ad Code Converter. Thanks for a useful tool!!!

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 engine.

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:

<script type="text/javascript"><!--
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";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

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!

Now I shall show you how to translate a Html code into a Xhtml code using Blogger Ad Code Converter. You can get this tool for free by clicking here.

What you need to do is that, register for AdSense, AdBrite, Chitika eMinimalls,... and get the Ad Code from there. You paste that code into Blogger Ad Code Converter. You can get your Xhtml code in a moment. Highlight All it, and paste it into your Html source where you would like. I'm sure that it works well!

Please see the following picture:

I wish you can solve your problem as what I have done!

1 comments:

Blogger said...

If you are looking for a solid contextual advertising network, I recommend you check out Chitika.

Enter your email address:

Delivered by FeedBurner

Watch the latest videos on YouTube.com
Your Name :
Your Email :
Subject :
Message :
Image (case-sensitive):