Techie Zone

How to put Adsense in New Blogger

Tuesday, March 06, 2007

ŠŠŠŠ

When Blogger transformed into the new XML based interface I was quite apprehensive of moving into the new blogger template. I found it damn dificult to customize the template according to my wishes but now I am gradually getting hold of the new template. And now onwards I will post some hacks I have made in new blogger. It is time for putting the adsense code in new blogger.

The easiest method to put adsense code in new blogger is by creating page elemet for adsense or html/java script at the top and bottom of blogpost element as shown in picture. But the main
problem in this technique is that the adsense ad will appear at the top and bottom of the page and not in each individual post.

Now we will do something so that adsense ad will appear at the beginning and end of each posts. And that can be done by adding the code by directly modifying the html (rather XML) code of the template. But when you will insert the adsense code directly inside XML code of the blogger you will receive an error that reads something like this:

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.
The above error means that the adsense code is not a standardized XML format. So we need to modify the code (But google does not allow the modification of adsense code, do not worry..google only tells that minor edits on Google Adsense Code for Blogger Beta/XML are allowed as long as the resulting Adsense Code generated by Blogger is exactly the same as given from Google Adsense Code Generator. So as long as find the same adsense code as the adsense code generator generated by viewing the page source where the adsense code appears you are not violating the TOS.). In XML, <, >, " and " are not recognized. So we need to replace these character with their valid XML notation as shown in figure below:
Once you create the adsense code from the adsense code generator, you have to make the above changes, which can be done with the use of a notepad (by find and replaced command) or with a html parser.

Now in the following steps we will put the modified adsense code where we want it to appear:

1. Go to your blogger dashboard and click on Layout.2. Click on Edit HTML
3. Click on Expand Widget Templates4. Now put the modified adsense code at the place as shown the following figure:


The final result will be shown in your blog like this:
In order to make the ads appear below the post body you can add the code at the place as shown in the figure below:


Posted by Alex @ 5:02 PM  

3 comments:

Its informative post.can u use google adesnse to get ads in ur posts. i mean u have "blogspot" in ur address.. still can u use google adsense.

Sagar said...
Wednesday, 04 February, 2009  

No Prescription medication Pharmacy. Get Cheap Drugs online. Buy Pills Central.
[url=http://buypillscentral.com/buy-generic-brand-levitra-online.html]Order Best Viagra, Cialis, Levitra, Tamiflu[/url]. prescription generic drugs. Discount medications pharmacy

Anonymous said...
Wednesday, 11 November, 2009  

Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!

Anonymous said...
Friday, 13 November, 2009  

Post a Comment