Followers
Wednesday, April 25, 2007
I am going to teach you to add AdSense code to your posts. Since it can be an overwhelming process, I'm going to break it down into several posts.
This post will teach you how to make the code compatible. To use AdSense code inside a post it is necessary to "escape" the AdSense code. The reason: If you put the code into your template just as it is written when you display the source code for the page, the Google data is invisible...that does not make Google happy and it is a TOS violation of AdSense...and they will pull your account for that!
Adsense does not allow you to alter their code other than "minor" edits. what we are going to do is considered a "minor" edit.
I contacted AdSense with the following question:
Subject: Wrapping Adsense code in blog post
Date: Wed, 18 Apr 2007 09:12:15 -0700
I would like to put the adsense ads inside of a blog post. To make it look EXACTLY like you give it to me (when viewed as a Page source code) it is necessary for a minor alteration. For Blogger to parse the Adsense Code in XML template, the Javascript has to be escaped, using html entities...It looks EXACTLY like you gave it out when viewed by Page source, so is this permissable?
Adsense answered my email with this:
Hi Bonnie,
We do permit minor edits to the AdSense code to place inside the blog posts. Please keep in mind publisher may not alter any portion of the code or manually change the layout of the ads. For instance, publishers may not alter the ad height variable to mask the Ads by Google moniker.
Thanks for your cooperation.
Sincerely,
Sean
The Google AdSense Team
So here is how we are going to parse the HTML to make it compatible and when viewed by using the Page Source code, it will look exactly as given to you by Adsense.
This is an example of a piece of Adsense code as given out by Adsense:
<script type="text/javascript"><!--
google_ad_client = "pub-XXXXXXXXXXXXXXXX";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel = "";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
You are going to change the (<) to (<) and the (>) to (>) and the quote marks ( " ) to (") They will all be HTML entities. The code will then look like this:
<script type="text/javascript"><!--
google_ad_client = "pub-XXXXXXXXXXXXXXXX";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel = "";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
The next post will show you how to place this in your template!
22 Comments:
Subscribe to:
Post Comments (Atom)
Sorry to intervene on this post but I couldn't find your e-mail.
I read your post about the Blogger NavBar. I fear that if I follow your suggestion, maybe Blogger delets my blog. I think that's too risky.
But I wonder if I can at least remove the search button from it, since I do not keep archives and do not want any reader to find older posts.
Please, help!
Blogger will not delete your blog for removing the Blogger NavBar. That is NOT at TOS violation, because when you click the "next blog" button, it will sometimes take you to pornographic blogs.
Blogger can not force you to give access to evil places like that.
If you notice ALL of my blogs have the Blogger Navbar removed, and I am an "official" Google designated Blog*Star. Which means that I am given permission by Google to dispense advice about Blogger.
I also put adsense code inside post body and it really helps. My adsense revenue are increasing. My friend ask me if this breaks google rules or not. I am glad that I found the answer here :). I write it here
Cheers,
Brielevan
this post help me too much. i want to do something more .
i want to limit no. of posts in label. like i want to limit no. of posts to 5 when anyone click on any label and to see more he can click on older posts . do you have any solution??
Thanks a lot.
Sure, the ad is placed where you want it to and how you want it. Then again, won't it be placed more than 3 times since it's done this way? More than 3 times as you know, breaks adsense TOS.
Obviously it doesn't actually show up 3 times in the page, but won't adsense bots think you're posting it more than 3 times on your blog?
-Taylor from codfedchatnet.blogspot.com
Thanks.
Use the adsense widget that they give you as an 'add a page element' in the meantime!
I guess is too late for me to alter my adsense code because when i went in to my Html file and searching for replacing my code(Absense code)again and is gone...and do you mind to look at my blog and i can give you my blog name.
thanks/Maggie.
Your article helped me to add AdSense code between the 'post end' and 'comments'.
Thanks a lot!
Greetings from Macedonia!
Do you have a Google account?
And lastly...if you can re-do what you did to get that message....copy the whole message here so that I can read it!
saya memparse kode adsense dan saya tidak tahu apakah itu aman atau tidak
I did everything that you mentioned and it worked out fine. But I had an issue. The first three posts shows the Ads. But thereafter, there is a huge gap with no content on the other posts. These should be the places where my Ads should appear. I have no idea as to what I should do. Plz do help me out. Have a wonderful day!
Regards,
Ajit
Left of what?
http://www.eblogtemplates.com/blogger-ad-code-converter/