How to manually place an AdSense ad unit in WordPress

Google AdSense now uses Auto ads as the default method to display ads. As the name suggests, Auto ads place ads automatically on your site. Their position, number, and sizes are up to AdSense.

Publishers who would like to optimize their revenue, test different placements and networks, or control the position of ads can still place them manually.

The following tutorial explains creating an AdSense ad unit and placing it manually on your site.

Basic setup

For this tutorial, you’ll need

Create a new ad unit in Google AdSense

  1. Visit your AdSense account. You can probably find it following this link.
  2. Navigate to Ads > Ad units.
  3. Click on one of the ad type buttons and choose between Display Ads, In-feed ads, In-article-ads, or Multiplex ads.

We will look at the most common ad types here and ignore the Search engine ads.

Tips for naming your ad unit

I see different naming styles for ad units every day. While the exact format may vary, I find it most helpful to have at least the following information in the name:

  • the website, if you have more than one
  • position on your site
  • format (e.g., “Medium Rectangle”) or size (e.g., “300×250”)
  • device (e.g., “mobile” or “desktop”)

A good name allows you to find an ad again quickly. An example could be

Sidebar top | Large rectangle | desktop

You can differ from this pattern, but I highly recommend using the same structure in all names.

A) Display ads

Display ads are the oldest and most used ad format.

Click on the icon of this ad type and start entering a name as suggested in the section above.

Responsive display ads

The most critical choice for Display ads is the one about the size.

AdSense’s recommendation is to use a Responsive ad format, which means that the width and height of the ad will be selected automatically by AdSense. They usually fill out 100% of the available width of the element the ad is placed in. E.g., if your sidebar is 300px wide, the ad will be 300px wide as well. This format is the best choice for responsive themes.

AdSense responsive ad settings
Name your ad and choose between a square, horizontal, or vertical layout

Fixed-sized display ads

There are a few situations where you might want to have a fixed ad size. The most common is that AdSense cannot always determine the available with so that the ad space stays unused. Or that you want to float text around an ad, which is also not possible with responsive ad types.

For testing, I’d recommend a 300×250 Medium Rectangle. Go to the Ad Size field at the top right, select Fixed and enter the values for width and height as in the image below.

AdSense ad fixed size settings
Define a fixed size for your ad unit

Get the code

Click on Create to get the ad’s code.

Advanced Ads will later get the code automatically, so you don’t need to copy it. Jump ahead to this step.

B) In-article ads

Instead of a Display ad, you can also use the native In-article ad format, which is supposed to appear within large text blocks, like articles in a blog.

Click on the In-article ads icon on the Ad units page.

You should see a preview of an article with an ad now.

AdSense In-article preview
Example of an In-article ad

You can change the width of the preview with your mouse. Just drag the blue vertical rectangle at the top right of the preview window to the correct size.

Enter the ad unit name following the suggestions above in the name field at the top of the options field.

Additional options

You will see more options to customize the in-article ads on the right side of the screen. For example, you can change the font and font colors to make these ads fit the layout of your website and increase the click-through rate.

I recommend keeping the Google-optimized styles option enabled in the Style section — no need to over-optimize something in the first step.

Furthermore, you can set the Global options to allow embedding display ads within the in-article ads. Keep the default option enabled to increase competition on this ad.

AdSense In-article ads options
Options to customize In-article ads

Get the code

Click on Save and get code.

Copy the code from the appearing window and move on to the next step.

C) In-feed ads

The ads are intended for placement on archive pages and lists. You can adapt your website layout for this native ad format.

In-feed ads example

In our In-feed ads tutorial, you’ll learn how to create these ads in AdSense and embed them on your website using Advanced Ads.

D) Multiplex ads

Multiplex Ads are following the deprecated Matched Content ad units. In this native ad format, the ads resemble the Related Articles blocks embedded on many websites.

Multiplex ads
Example of the Multiplex ads

In our separate Multiplex ads tutorial, you will find detailed step-by-step instructions on creating Multiplex ads in AdSense and integrating them into your website.

Place the AdSense ad on your WordPress website

Once you have the AdSense ad code from one of the ad types above, you can log in to your WordPress site.

When you have Advanced Ads installed and activated, you should see an Advanced Ads menu icon in your backend.

Advanced Ads menu item

Connect with AdSense

Go to Advanced Ads > Settings and select the AdSense tab.

Click on the Connect to AdSense button, choose your Google account and copy the verification key into the appropriate option in Advanced Ads.

Connecting Advanced Ads with Google AdSense

Your AdSense account should now be connected to Advanced Ads and allow you to pull the ad codes automatically.

Create an ad unit in Advanced Ads

  1. Go to Advanced Ads > Ads and click on the New Ad button.
  2. Enter a title for your ad – it is only visible to you. You can follow the suggestions I gave above for the name in AdSense or reuse it.
  3. Select AdSense ad in the Ad Type box.

From here, you have two options, depending on whether you are using Display ads or native ads.

A) Display ads

AdSense ad unit list in Advanced Ads
Example of the AdSense ad unit list in Advanced Ads
  1. Select the ad from the ad list by clicking on the appropriate row.
  2. Click on the Publish button to save the ad.
  3. Go ahead to the Place the ad section.

B) Native ads (In-article, In-feed, Multiplex ads)

The native ad formats In-article, in-feed, and Multiplex ads might appear in the ad list, but getting it results in an error since AdSense does not support this feature.

Instead, click on the Insert new AdSense code link and paste the In-article AdSense code into the appearing text area.

Inserting AdSense code manually
  1. Click on Get details. The last step will import the details of the ad into Advanced Ads.
  2. Click on the Publish button to save the ad and move on to the next step.

Place the ad unit

Advanced Ads separates content (ads) and positions (placements) to make you more flexible when rotating or replacing ads.

There is a large number of options to place the ads. You can place them manually using shortcodes or a sidebar widget or use a placement to inject the ad manually without touching any code.

In the rest of this tutorial, I will explain how to add this ad to your site’s content automatically. After all, this is the best performing and recommended position for AdSense ads.

When you first hit the Publish button on the ad edit page, you will see a field like this:

Advanced Ads ad placements

It shows a few possible ad positions, including the ones before, after, and in the middle of the content.

If you don’t see this field or missed it, go to Advanced Ads > Placements and click on New Placement.

In both cases, choose the Content placement, which has the following icon.

ad placement within the content

Now, select the paragraph after which the ad should appear. A well-performing content ad appears after the first, second, or third paragraph.

On Advanced Ads > Placements, you can also select a name and edit or add the ad to the placement. This step is not needed if you chose it while creating the ad.

Anyway, you should check out Advanced Ads > Placements to see that all options are selected correctly.

For further information on placements, see

Monitor AdSense earnings in your backend

When you navigate to Advanced Ads > Dashboard, you will see a meta box showing AdSense earnings of all websites related to the connected AdSense account. 

You can switch the view between individual websites using the network icon.

AdSense earnings in the WordPress backend
See your AdSense earnings in the Advanced Ads dashboard

If you open one of your AdSense ads in Advanced Ads, you can find the earnings of that specific unit in the AdSense Earnings meta box below the title.

To stop loading stats from AdSense into your WordPress backend, activate the Disable stats checkbox in Advanced Ads > Settings > AdSense

See notifications

Advanced Ads imports the revenue statistics and the notifications that show up in your AdSense account.

These could be, for example, a reminder about a missing ads.txt file or warnings about ads in content that violates the guidelines.

AdSense warnings
See AdSense warnings in your WordPress backend

Advanced Ads imports all these notifications from your AdSense account. If you connected multiple websites to your account, the plugin would also import messages that affect other websites.

For example, if you do not provide a valid ads.txt on one of your websites, you will also receive this notice on your website that you have connected to Advanced Ads and AdSense even if this page has an ads.txt.

Subscribe to our newsletter and get 2 add-ons for free!

* indicates required

Troubleshooting

New AdSense ad units might take up to 30 minutes to appear if your account is fully approved. With unapproved accounts, it might take 48 or even longer until the ad is showing up on your site.

Still not seeing any ads? Switch the ad type in Advanced Ads to Dummy. If you see an ad output now, the problem is with AdSense and your account. If not, please follow the information on Ads not showing up. Suppose you see the no Slot size for availableWidth error in your browser console, it helps to use ads with a fixed size when they are not appearing.

AdSense does not suggest a specific amount of ads on your WordPress site, but there shouldn’t be too many ads too close together. AdSense can also decline to show specific ads if too many are placed already.

Unwanted Auto ads

Since 2019, AdSense can inject Auto ads on every website that contains any AdSense ad unit code. If unwanted Auto ads appear on a page with manually inserted AdSense ads, you can only disable them in your AdSense account. Find a short description of how to do this in our manual.

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.