Thursday, February 26, 2009

Placing Google Adsense Under The Posting

Many bloggers who want to put their Google Adsense ads right under the blog article. But that was the case, the Adsense is code that can not be installed directly in the HTML template in our blog. If we are forced to install, then the message will usually appear 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

Even if we successfully save the adsense code in the template, the code that will not be able to display adsense ads. Therefore, there is one thing that we need to place Adsense code in the blog template so that our ads appear under the post: parse adsense code. What is mean of PARSE???.

The purpose of the parse is to change the adsense code to be included in the template and displayed in the post. Example of adsense code before parse such as this.

<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxx";
google_ad_slot = "0276016466";
google_ad_width = 121;
google_ad_height = 60;
//-->
</script>
<script
src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script>


After adsense code parsed, the results like this.

&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;pub-xxxxxxxxxxx&quot;;
google_ad_slot = &quot;0276016466&quot;;
google_ad_width = 121;
google_ad_height = 60;
//--&gt;
&lt;/script&gt;
&lt;script
src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;
type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;


Hmm, now the code that you can place it in your blog. But the question appears: Google TOS does not allow us to change the adsense code for any reason, whether it is allowed? The answer is, "Google Allow this method." How may I dare to say how this is allowed? Of course. There is someone who wants to make sure that it's allowed. He sent a letter to Google that the content is as follows.

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
.


Then Google reply above email that its contents are as follows.

Google then respond through the email contents as follows.


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



That is, we can parse the adsense code that we have. Lets parse adsense code you have. Once completed parse the adsense code, enter the code in the template to you by following the steps below.


  1. Go to Layout.
  2. Click on Edit HTML. Mark on Expand Template Widget.
  3. Search this code: <p><data:post.body/></p>. If you use a template then select a code structure like this. <p><data:post.body/></p>

    <b:if cond='data:blog.pageType == "item"'>
    <style>.fullpost{display:inline;}</style>
    <p><data:post.body/></p>
    <b:else/>
    <style>.fullpost{display:none;}</style>
    <p><data:post.body/>
    <a expr:href='data:post.url'><strong>Read more...</strong></a></p> 
    </b:if>


  4. Paste your adsense code under the <p><data:post.body/> code. Example like this.

    <b:if cond='data:blog.pageType == "item"'>
    <style>.fullpost{display:inline;}</style>
    <p><data:post.body/></p>
    <b:else/>
    <style>.fullpost{display:none;}</style>
    <p><data:post.body/>
    <a expr:href='data:post.url'><strong>Read more...</strong></a></p> 
    </b:if>


    <br/><br>/&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
    google_ad_client = &quot;pub-xxxxxxxxxxx&quot;;
    google_ad_slot = &quot;0276016466&quot;;
    google_ad_width = 121;
    google_ad_height = 60;
    //--&gt;
    &lt;/script&gt;
    &lt;script
    src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;
    type=&quot;text/javascript&quot;&gt;
    &lt;/script&gt;

  5. Then save your template.



Please wait some time (10 minutes), you will see your adsense ads appear below the article of your blogs.

0 comments:

Post a Comment