Google Adsense In Blogger Beta XML Update
For better formatting see article mirrored.
As previously posted and mirrored here, the only way to insert adsense into the body of the post is to escape the Adsense code; meaning replace all the special characters with HTML entities, for example '<' with < '>' with > So, your Adsense code may look like this in the beginning:
<script type="text/javascript"><!--And end up look like to be accepted by Blogger XML Template:
google_ad_client = "pub-xxxxxxxxxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "F15005";
google_color_bg = "F15005";
google_color_link = "FFFFFF";
google_color_text = "FFFFFF";
google_color_url = "FFFFFF";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--I have a special web application specifically designed to do this, see my HTML Parser here.
google_ad_client = "pub-xxxxxxxxxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "F15005";
google_color_bg = "F15005";
google_color_link = "FFFFFF";
google_color_text = "FFFFFF";
google_color_url = "FFFFFF";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
There are some concerns though both from other bloggers as well as myself as to if the above would be violation of tempering Adsense code as state in the TOS. So, I contacted Google Adsense Team through several emails and here they are in chronological order:
Hello Adsense Team:
This question is regarding putting Google Adsense code in new Blogger(owned by Google) into new XML templates. In order for Blogger to parse the Adsense Code in XML template, the Javascript has to be escaped, meaning replacing all the '<' with '<', '>' with '>' etc. After you publish you blog, and view the HTML code produced by the blogger, it would be the exactly the same as given from the Adsense generator. Would this be tampering of code even if the final displayed Adsense code is the same?
Thank you,
Regards
Initial email, stating the issue
Hi,
You are permitted to make minor edits in Blogger Beta. However, please keep in mind that in general publishers are not allowed to alter the AdSense ad code for any reason. Once you've generated the ad code in your AdSense account pages, you may not alter any portion of the code or manually change the layout of the ads.
Thanks for your understanding.
Sincerely,
The Google AdSense Team
mmm, kind of ambiguous, what exactly are the minor edits? So here is the follow up email
Hello:
Thank you for your reply, however I find your answer ambiguous. First you
mentioned minor edits for BLOGGER BETA is allowed and then GENERAL PUBLISHERS are not allowed to alter the generated Adsense code.
Is the 'minor' edits of escaping HTML entities for XML parsing allowed as long as when displayed in HTML the adsense code is exactly the same as given from the Adsense generator?
Sorry for asking again, I just don't want to violate the Google Adsense TOS. Thanks for you consideration and all your help.
Thank you
Regards
And this is the answer
Hi,
To clarify, while you are permitted to make minor edits in Blogger Beta, to allow the ad implementations to function properly, you are not permitted to alter the code for the purposes of changing size, font or hiding the Ads by Google logo.
Thanks for your understanding.
Sincerely,
The Google AdSense Team
There you go, AdSense does not clearly state anything however from these email I conclude that replacing special characters with HTML entity are allowed. Since Adsense won't give a clear rule, here is my own:
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.
This means if you goto your blog, eg. http://customtemplates.blogspot.com/
and click View --> Page Source (Firefox) or View --> Source (IE), the Adsense Code there should be exactly the same as given from Google Adsense Code regardless of what you put in your Edit HTML section in Blogger.
To parse your Adsense click here and for information on adsense placement see this article. More information & placement positions are coming.
2 comments:
-
This how-to is neat. I've been trying to insert additional Adsense to my template.
I got it working on my blog instantly after following your how-to.
Thanks.
-
Thanks radar, glad it worked. Unfortunately blogger is not great with posting code so the previous post maybe unclear the better version is on blogcrowds.com.