Home✔bloggingHow to Create Perfect AdSense Ad Units and Add code to WordPress

How to Create Perfect AdSense Ad Units and Add code to WordPress

Published on

One of my readers declared her interest in learning how to create the perfect AdSense ad units and adding them to her WordPress site. Answers were provided to her. I decided to share this information with other readers interested in doing the same.

AdSense has so many features that will help you display ads on your website with ease and automation. After the introduction of AdSense auto ads, publishers can now leave the task of ad placement to AdSense.

However, if you are interested in having full control on how ads appear on your site, there’s a need to create ad units.

After creating ad units, you can add them to any section of your site: like, your homepage, blog sidebar, page footers and headers. This can be done using ad management plugins or manually.

Note: creation of ad units is not possible till you have successfully applied for an AdSense account and verified your WordPress website ownership with that AdSense account.

After AdSense account creation and verification, ads begin to appear automatically on every section of your website. Even on pages that may violate AdSense terms or other pages you may not be interested in seeing ads appear on, like, privacy policy, about, etc.

To prevent this from happening, you can either create ad units and choose where to place them on your WordPress site or set up AdSense auto ads and choose a global setting that excludes the pages you don’t want ads displayed on. For this guide, you will learn how to achieve that with AdSense ad units

What are ad units?

An ad unit is a piece of code generated and added to your site. This piece of code creates an ad slot containing your publisher ID. Once added to your site, AdSense ads will begin to appear in the exact spaces where they’ve been added on site.

With ad units, you have complete customization control. You can decide to switch ads positions or remove particular slots from displaying on your website.

What are the importance of ad units?

  • Full control of ad sizes and placement on your site.
  • Easy removal or addition of ad slots.
  • Opportunity to maintain a good UX (user experience). You can choose to display on 3-4 ads, depending on your interest.

Types of ad Units

There are basically three types of ad units in AdSense. They are:

  • Text & display ads: These types of ads can be added in pages blog sidebars, footers and other section of your post.
  • In-feed ads: These ad unit are most suitable for pages that display list or excerpts of your blog posts. Like the blog section of your website.
  • In-article ads: Ads that appear between the paragraphs of your articles.

A perfect combination of all those ad units will help improve your Click-through-rate (CTR) and ultimately, your AdSense earnings.

Various sizes and styles of ad units

Ad units come in various sizes, styles and design. The range of sizes you can choose from are:

  • Recommended
  • Horizontal
  • Vertical
  • rectangular
  • responsive
  • custom size , and
  • link ads.

Most times, it is advisable to choose the responsive ads. Especially if you don’t know the exact dimensions of the location you are trying to display ads on. However, if you are interested in creating custom sizes, I advise you create 336:280 or 160:600. Both sizes look good on all devices and guarantees better CTR (click-through-rate)

If you know the exact measurement, you can go ahead and click on custom size and enter the exact dimensions of the ad unit you intend to create.

I advise you though, to always stick to the responsive ads. Responsive ads can adjust to different shapes and screen sizes whether on mobile, desktop or tablet.

Creating ad units

Step 1: Login to your AdSense dashboard and click on ‘My ads’

ad unit types

Under my ads, click on ‘Ad units’ and under ad units, click on ‘New ad unit’.

Step 2: select ad type.

Types AdSense ad units

You will be prompted to choose the type of ad unit you wish to create. For a start, select Text & display ads. You can always create new ad units of the same or different types.

Step 3: Choose name and size for your ad unit

create ad name and size

The name of your ad is for reference purpose. Choose a name that you can remember. For Example, Display Ad Unit 1.

And for the size, Like I said earlier, responsive ads work better, so that’s what you must choose.

Step 4: Customize ad unit style.

choose ad style

You can stick to the default ad style. However, if you want to create a custom style, click on create ad style, name your style and choose your preferred color.

Make sure the colors you choose for your ad unit correspond with the colors of your theme. This improve help improve the UX (user experience) of your website.

After customizing your ad unit to your satisfaction, click on ‘save and get code’

ad unit code

A code containing your publisher ID will be generated. Copy that code to your clipboard. That is the code you will need to add to the desired section of your WordPress website.

You can go ahead and repeat the above steps, but this time, choosing a different ad type.

How to add AdSense ad codes to WordPress

From my experience, the two most effective methods to do these are: adding the code directly to your theme using the appearance menu or using WordPress ad management plugins. I must admit though, using an ad management plugin works best.

How to add ads to WordPress sidebar

First, login to your WordPress dashboard, hover on appearance and click on widgets.

click on widgets

Depending on your theme, sections of your website will be shown. In my case, I have the blog sidebar, footer 1-4, and site homepage area.

website sections

drag and drop Custom HTML from left side to the section of your site you wish to display AdSense ads on. For this guide, we shall be adding this code to your blog sidebar.

Ad unit in blog sidebar

Name your ad whatever you like or leave it blank. Paste your AdSense code in the content area and click on ‘Save’. Ads will begin to appear in the section you have chosen to display it on.

You can go ahead and repeat this process on other section of your site, like, header, footers, etc.

Using ad inserter plugin

There are a lot of ad management plugins in WordPress. But for this guide, I prefer to go with the Ad Inserter Plugin. Because of its user friendliness, plus, it’s FREE. Although you can upgrade to PRO if you are interested in enabling more functionalities or getting support, that is not necessary if you follow this guide.

First download and install ad inserter plugin. You can learn how to install WordPress plugins from my previous guide.

After installing this plugin, it should be located within your AdSense dashboard, under settings.

Hover your mouse cursor on settings and click on ad inserter.

click on ad inserter under settings

The ad inserter plugin provides up to 16 blocks (spaces) for you to add different ad codes.paste ad code in space provided

Paste ad code in the blank black section, select the if you want to see the ads within your post and static pages. When you are done, click on ‘Save All Settings’.

A shortcode will be generated. That shortcode can easily be added to sections of your site or pages you want those ads to appear on.

You can make use of the automatic insertion option. By default, it is disabled. click the arrow down to see the options to choose.

Click on the exact position you want ad displayed. Options you have are:

  • Before post
  • Before content
  • After post
  • Before paragraph
  • After paragraph, etc.

If you are interested in displaying ads within your posts, after or before specific paragraphs, then you must create a new ad unit called ‘In-article ad’. Reason is that, banner ads may not work very well within paragraphs. They may hurt your UX.

That’s all about creating ad units and adding AdSense@question about adding AdSense code to your WordPress website, feel free to ask using the comment section of this post.

Follow us on Facebook and Twitter to get access to great AdSense monetization tips.

Latest articles

Who is The Tenge Tenge Kid?

Videos of the Tenge Tenge kid have garnered hundreds of millions of views on...

List of Nigerian States with APC Governors

Discover the list of Nigerian States being governed by the All Progressives Congress (APC)...

See the Names and States of PDP Governors in Nigeria in 2023

Get to know the governors leading their states under the People's Democratic Party (PDP)...

Present Governors of All 36 States in Nigeria, Deputies & Parties (2023)

This post provides information on the present governors for all 36 states in Nigeria....

More like this

Who is The Tenge Tenge Kid?

Videos of the Tenge Tenge kid have garnered hundreds of millions of views on...

List of Nigerian States with APC Governors

Discover the list of Nigerian States being governed by the All Progressives Congress (APC)...

See the Names and States of PDP Governors in Nigeria in 2023

Get to know the governors leading their states under the People's Democratic Party (PDP)...