Tuesday, October 1, 2013

Putting AdSense Ad Code on Your Blogger Blog

If you're new to blogger, new to web publishing, or new to AdSense you might need a little help getting your ad codes onto blogger. For those of us who have been using this platform since it came out, placing ad codes seems like a simple thing, but for newbies it can be confusing. Particularly since blogger seems to be constantly changing the way things are done.

With blogger, there are multiple ways you can get your codes onto your blog. There are several types of gadgets that will work, or you can use the earnings tab, or you can even paste code directly into the text area. Keep in mind, pasting code into the text area may not always work. It will depend on the type of template you are using for your blog - usually a standard blogger template works best for that. If you use third-party free templates, or blogger's dynamic template, posting ads in the text area may not work at all. The instructions below are for using normal blogger templates (standard ones, not the dynamic ones).

Page-Level Ads

Adsense's new "Page-Level" ad code is designed to show specific styles of ads on mobile views only, and not to show ads on the web view of your blog. If you follow the instructions to place page-level ads in the html of your template (not your blog post, but the template html) you will probably get an error notice when trying to save the template.

You'll need to alter the code slightly in order to have the template accept it. Although we aren't allow to manually edit AdSense codes, in this case, altering the code is allowed in order to make it work on Blogger. Not all edits are allowed of course, so you should never alter your codes without checking - you can ask in the help forum if you feel you need to edit a code manually.

The error shows as: Error parsing XML, line 7, column 15: Attribute name "async" associated with an element type "script" must be followed by the ' = ' character.

To fix it and get the template to accept the code, change this:

to this for the beginning line of the ad code:

<script async="async" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>


The template should now allow you to save the added code.

Using a BLOGSPOT URL

If you use the free blogspot URL, almost all the available methods will work if you've been approved to place an ad code.  Keep in mind that being asked to place the ad code doesn't mean the ad will display right away, so all you may see is a space where the ad is placed (in some templates, you might not see any space at all).

Because the approval process can take a few weeks to complete you might see ads for a short period of time when first placed, then they suddenly disappear. That's because ad code/ads collect "impressions" (that's visitors coming to the page) and when there are enough impressions, the second part of the review will begin, and you won't see ads for a while again. Not until they approve your blog. So, to place the code you can use the AdSense gadget (which places code for you, so no copy/paste required), or you can paste ad code that you've been given or created in your AdSense account into an html gadget. You can also choose to have ads between your posts if you'd rather have that - you can edit the post template to choose that option. The simplest method is to use the earnings tab in your blog dashboard, choosing where to place the code using the radial button. Some of these options may not work if you are using a custom domain with your blog (the earnings tab may not be available).

Two types of gadgets to place Adsense code in your blogger blog.
You can use the AdSense Gadget from the layouts page. OR
You can use the html gadget and paste code into it from the layouts page.
On the layouts page, simply click +New Gadget and choose the type you want.


Using the adsense gadget provided by blogger.
Blogger's Adsense gadget offers several options for ad types and sizes in
the drop down menu. There is no need to paste code into this gadget.
You can choose the colours for text ads once you've chosen the size and type of ads.

Placing ads between posts using blogger's posting template.
To place ads between posts, go to the layouts page and in the blog posts template
Click the "edit" button.

How to set up ads between posts on blogger.
When the "edit template" dialogue opens you see the options available.
Scroll down until you see "show adsense between posts" and select that.
Don't forget to click "save" at the bottom. Also note that choosing ads between posts
means you need to set your homepage not to show more than 2 or 3 posts, or you'll have
too many ads on a page. Ads in sidebars and other gadgets also count towards the total ads.


Using the Earnings Tab (when available)

The earnings tab for Adsense on blogger.
On the earnings tab of approved blogs, you can choose where
you want your ads to display, and blogger will place them automatically.


Using a CUSTOM DOMAIN

When directing a custom domain to your blog, not all of the above options may work. If the earnings tab isn't available, or the AdSense Gadget shows an error when adding it, you'll need to use the html gadget and ad code from your account.

Pasting Adsense code into blogger's html gadget.
Use the html gadget to place ad code from your "MyAds" tab in your
AdSense account. Once saved, you can drag the gadget to any spot on
your layouts page that accepts a gadget. Be sure the ad size is compatible
with the space you place the gadget in.


Placing Ads in the Text of your Blog Post

You may find some tutorials on other blogs for parsing AdSense code and placing it directly in the html of your blog's template. Personally, I find this option less than satisfactory, and it can result in errors from clicks not being recorded, or sometimes the ad not being clickable, or the ad being in the wrong spot in the post. Once it is in your template, it shows up in the same spot on each post you publish.

This isn't always a good thing. Some posts you may not want ads on, or some posts you might want ads in a different spot. Keep in mind that no matter how you place the ads in your blog, publishers are allowed no more than 3 Adsense ad units on any page, so if you have ads in gadgets, or are placing ads using any of the other methods listed above, placing another ad in your post MUST NOT lead to having more than 3 ads on the post when it's published. When I have a popular post where I might want to place a third ad (I generally only use 2 in my sites), I simply copy the ad code from my account and paste it directly into the post editor, using the html option, rather than the "compose" option. Keep in mind you need to add a couple of line spaces manually, or you'll have an ad that's far too close to the content (and cause a violation). Make sure the ad size fits within your posting space. Don't try to paste an ad code for an ad that's too large into the space, or it will cover contents, or part of your sidebar.

How to paste the adsense code directly into the text area of a post.
Click the HTML button at the top of your posting editor while preparing or editing a post.
Paste the ad code into the text area, being sure to add a few line spaces. Publish your post.


When you're ads display in your text area.
Once your ad is visible, check the placement to make sure the ad isn't
too big for the space, and is far enough away from the content.

Questions? Just ask by leaving a comment and I'll be happy to answer them if I can.

posted by J. Gracey Stinson
Updated Aug. 27, 2016

1 comment:

  1. Thank you for your answers provided I believe it will help me.

    ReplyDelete

Please do not drop links here using monetized URL shorteners or the comments will be marked as spam.

If you want help with an actual blog or website, please just post for help in the Adsense forum, or leave your G+ profile link. I will not publish comments with blog/website or channel links.

Thanks.