How to Put AdSense Code in the Blogger Post Body?

What is Additional?

  1. Reduced the need for
    (line break) tags in his code and using CSS style “clear:both” for the same purpose. 2. Modded this code for center alignment by using HTML5 properties. 3. Add XML code that will load only on the Blogger item page rather than loading on other pages to save your blog performance.

How to Paste Ad Code on Blogger?

Now, I will discuss how to install/ integrate/ inject this script into your blogger theme. (!) Must take a backup of Blogger theme before making any change.

  1. Find thetag in your blogger template and place the latest jquery just below it. Please avoid using two jquery links. Remove the older one and use the new version.
  2. Second look for this code data:post.body/ inside Blogger theme and replace it with the following code – New Blogger template may have 2 or 3 data:post.body/ code. You should have to identify correct one. Generally 2nd instance of data:post.body/ is right code to replace in new blogger templates.
  3. Now search fortag inside Blogger theme and put the following javascript before/ just above it.
  4. Save the changes made in the Blogger theme and have fun.

You can choose your Ad location –

By replacing the value br:lt(1) with br:eq(n), where n= 1, 2, 3… which is the number of line breaks after which Ad will appear in your post. E.g., If you want to show Ad after the 5th line break, then replace br:lt(1) with br:eq(5), and you are done.

As far as we know, using this or a similar script to insert ads within your post content is legal because most of the users who are using WordPress, Joomla, etc., are placing ads with the help of similar scripts. It does not matter they are using PHP or javascript. The final choice is yours. You will use it for your blog or not. GitHub gist – https://gist.github.com/vinayprajapati/5893386

Conclusion

After long research and discussion, we found that adding Google Adsense code inside the post body is possible with javascript. It is absolutely safe to use it. It is our request from  Google to give such a feature with Blogger by default.

How to Put AdSense Code in the Blogger Post Body  Part 2  - 53