Thursday, July 21, 2011

Parsing and Wrapping Adsense Code inside Blog Post

Adsense is an important tool by Google targeting the advertisers to cast their ads and publishers to promote their web sites by providing links in blogs and websites.This in turn provides the content writers as a way to earn publishing ads relevant to their content.The other is through Adwords -  a paid advertisement to drive traffic to your website.

We can set up the adsense code by two means : one is by the Adsense build-in widget and the other is by getting the codes from Adsense setup.The former is done by going to your dashboard and then click add gadget .There, again click Adsense .You will be provided with a pop-up where you can select the type of ad your site needs and click save .(See the image below)

Use and Limitations:
This type of ad can be placed only through three ad units in the blogger which means that your ad place is limited like say you cant place the built-in Adsense ads within a post.Another limitation is that you can’t use channels to track the performance of each ad units.This limitation can be overcome by  getting the code directly through your Goggle Adsense.

Getting Adsense codes from Adsense setup
You might have noticed the below image in your Adsense account,In there, click Adsense Setup and follow the steps directed in creating your ads :

and get your codes .
After getting your Adsense code from the Adsense website , do the following :
  1. Parse the code to replace special characters with HTML entities [Important- see below]
  2. In Blogger, go to Layout, then choose Edit HTML.Dont forget to create a backup of your template by clicking Download Full Template
  3. Click Expand Widget Templates and search for <data:post.body/> or <p><data:post.body/></p>
  4. Place your Adsense code on the line immediately above this
  5. Finally ,save the template
Note : Place your adsense code within a floating div, so that the text wraps around it.

<div class='post-body entry-content'>
<div style='float: left;'>
&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;pub-xxxxxxxxxxxxxxxx&quot;;
google_ad_host = &quot;pub-xxxxxxxxxxxxxxxx&quot;;
google_ad_slot = &quot;xxxxxx&quot;;
google_ad_width = 336;
google_ad_height = 280;
&lt;script type=&quot;text/javascript&quot;

Your code will look like the above .This helps in getting your ads wrapped along with your contents in your blog posts.Placing adsense codes inside blog posts helps in getting more clicks which in turn helps you to increase your CTR. Remember,that blogger displays only three ads unit maximum, so if you have more than three than your extra ad is likely to be blank.

Parsing Tool

Happy Adsensing!

Febriana Febriana

About Febriana Febriana

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.