AdSense Ads

google adsense logoAdSense is a free, simple way to make money online by placing ads on your website. Google AdSense is a program run by Google that allows publishers in the Google Network of content sites to serve automatic text, image, video, or interactive media advertisements, that are targeted to site content and audience.

To get AdSense ads you need to place code for AdSense on your website. Ad Inserter is a perfect tool for this. Here we'll explain step by step how to place AdSense ads on your website. If you don't have AdSense account yet you first need to sign up.

PLEASE NOTE: To show Google ads on your site you need to place AdSense ad code on your pages.

Ad code: a snippet of HTML that when placed on any page of an approved site shows Google ads in a specific ad layout and format.

Ad unit: a set of Google ads displayed as a result of one piece of AdSense ad code. 

You can also check AdSense Help and Code implementation guide.

Ad unit

The first step is to create ad unit. Once you are logged in to AdSense go to My Ads / Content / Ad Units and click on New ad unit. You will be asked to choose the type of ad.

ad inserter adsense type

In most cases where you would like to place ads on your posts or static pages you'll need Text & display ads. Give your ad unit a name. It’s a good idea to use a unique, descriptive name that will help you find this ad unit later.

Text & display ads

In the “Ad size” section, choose the size of the ads that you’d like to show:

ad inserter adsense ad size

Here you can choose between responsive (automatic size) ad unit and fixed sizes. In general, wider ad units perform better. In most cases you can choose responsive ad unless you want a fixed size ad. In such case choose one of recommended ad sizes, which have shown to perform well across a variety of sites. Ad sizes that perform well on mobile are shown with a mobile icon.

Responsive ads

This ad unit will automatically adapt its size to fit your page layout. It's intended to work with sites built with responsive design, but will work on non-responsive sites too. Responsive ad units allow you to support a wide range of devices by working with your responsive design web pages.

IMPORTANT: If you would like to use floating ads (ads wrapped with text) or sticky ads (ads that stay fixed when the page scrolls) you need to choose fixed size ads.

However, regardless of what type of Text & display ad you will choose here you will be able to change size or responsiveness in Ad Inserter code editor for Check Code.

Next you need to choose Ad type. We highly recommend that you display both text and display ads. By displaying more ad types, you can earn more revenue.

You can also choose text ad styles, define custom channels and what to display when no ad is available. When you are happy with settings click on Save and get code. Once the ad unit is created it will show in the list of ad units where you'll be able to edit it or get the code for it. Ad unit changes may take up to two hours to appear in performance reports.

Ad code

When ad unit is created you can get ad code for it. In the list of ad units click on Get code link below ad unit for which you need to get code. A window will pop up. You can choose between Asynchronous and Synchronous code type. In most cases you should use Asynchronous code. It will look something like this:

<script async src="//"></script>
<!-- Ad Inserter 300x250 -->
<ins class="adsbygoogle"
  (adsbygoogle = window.adsbygoogle || []).push({}); </script>

Once you have the code you can copy it to Ad Inserter. In this example we'll create one code block for ads above second paragraph on all posts. Select one empty code block (here we'll use code block 10), click on the name to change it to something descriptive, paste the code for ad unit into code window below and set Automatic insertion to Before paragraph, Paragraph number to 2 and leave checked only Posts page type.

ad inserter adsense code

Save settings and check posts. Your code should be inserted and ads displayed before second paragraph in each post. However, it may happen that you'll only get blank ad blocks. Check Ads not displayed – troubleshooting section below.

AdSense code generator

Ad Inserter has also a code generator tool for AdSense. Check Code editing for details. This tool is mainly intended to change the type of AdSense ads. But please note: not all conversions are possible: you can convert standard text & display ads to link ads or vice versa, fixed width ads to responsive ads and vice versa and you can enable or disable ads on AMP pages. Once you have the Publisher ID and Ad Slot ID entered (or imported) you can change ad type, ad size (fixed, fixed by viewport or responsive) and ad type for AMP pages.

 ad inserter adsense code generator

Once you are happy with the settings click on the generate button and the the plugin will generate ad code for the AdSense ad in the code window of the current block.

ad inserter adsense geenrate

For standard and link ads you can choose between fixed, fixed by viewport and responsive ad sizes.

  • Responsive means that the ad will resize to fill available width. Suitable for all devices, however, it will not work when available width is not known (floating ads). In such case you need to specify ad width with custom CSS style.
  • Fixed means that you define one ad size and it will be used for all insertions of this code block.
  • Fixed by viewport means that you can specify fixed ad size for each viewport (device or screen size as defined in general plugin settings tab * / tab Viewports). This is the best choice for AdSense ads when there is a need to use different ad sizes on different devices. Leave size empty to disable ad for the selected viewport.

ad inserter adsense code generator viewports

AdSense Integration

Ad Inserter can be configured to get AdSense ad codes directly from the plugin settings page - no need to copy ad codes from the AdSense admin pages and paste them to code blocks. You can then list ad units, preview AdSense ads and get ad codes where you need them.

When access to your AdSense account is not enabled yet there will be AdSense ad units button in AdSense code generator.

ad inserter adsense integration

Click on this button to show AdSense Integration - Step 1.

ad inserter adsense integration step 1

The first step is to create a Google API project in order to get Client ID and Client Secret. Follow the instructions to get Client ID and Client secret and enter them in the appropriate fields:

  1. Go to
  2. Create Ad Inserter project - if the project and IDs are already created click on the Credentials in the sidebar and go to step 16
  3. Click on Select a project selection and then click on the + button to create a new project
  4. Enter Ad Inserter for project name and click on the Create button
  5. Click on project selection, wait for the project to be created and then and select Ad Inserter as the current project
  7. Search for adsense and enable AdSense Management API
  8. Click on Create credentials
  9. For Where will you be calling the API from? Select Other UI
  10. For What data will you be accessing? Select User data
  11. Click on What credentials do I need?
  12. Create an OAuth 2.0 client ID: For OAuth 2.0 client ID name enter Ad Inserter client
  13. Set up the OAuth 2.0 consent screen: For Product name shown to users enter Ad Inserter
  14. Click on Continue
  15. Click on Done
  16. Click on Ad Inserter client to get Client ID and Client secret
  17. Copy them to the appropriate fields

Click Save to get to AdSense Integration - Step 2.

ad inserter adsense integration step 2

Now you need to authorize Ad Inserter plugin to access your AdSense account to get ad units and ad codes. Click on Get Authorization Code to open a new tab where you will be able to choose AdSense account and grant read-only access to the account.

ad inserter adsense integration authorization

When you'll click on Allow you'll get authorization code which should be pasted in the appropriate field. Then click on Authorize and you should get list of AdSense ad units. Above the list there is a search files where you can search for ad units. You can search using multiple keywords.

ad inserter adsense list

After you finish authorization process there will be additional AdSense button on the tools toolbar. Click on this button toggles list of AdSense ad units.

ad inserter adsense button

Click on the AdSense button will open AdSense admin pages.

ad inserter adsense list admin

Click on Clear authorization button will remove access to your AdSense account.

ad inserter adsense list clear

Click on Reload button will reload AdSense ad units. If you create a new ad unit or make changes to existing ads you'll need to reload the list to get access to the new ad units.

ad inserter adsense list reload

Click on Active/All ad units button will toggle between active ad units and all ad units.

ad inserter adsense list toggle

Each ad unit has three small buttons left of ad unit name. Copy AdSense code button copies the ad code to the Ad Inserter clipboard. You can then paste it to any code block.

ad inserter adsense list copy

Preview AdSense ad opens a preview window and displays this ad unit between dummy paragraphs. Ad block may be blank – this is quite common when ad code has no ads to show.

ad inserter adsense list preview

ad inserter adsense preview

Get AdSense code button copies ad code to the currently selected code block. This is the quickest way to get AdSense ad code into code block.

ad inserter adsense list get

In-feed ads

What is a feed?

A feed is a stream of content that you can scroll through. The content appears in similar-looking blocks that repeat one after the other. For example a feed can be editorial (e.g., a list of articles or news) or listings (e.g., a list of products, services, etc.). Feeds can appear anywhere on the page.

Note: For the purposes of In-feed ads, a feed does not refer to a web syndication feed such as RSS.

Some examples of feeds on WordPress pages include:

  • The list of latest posts on a homepage (showing excerpts or full posts)
  • The list of latest posts on a category page (showing excerpts or full posts)
  • The list of latest posts on an archive page (showing excerpts or full posts)
  • Comments below posts

ad inserter adsense in feed ads

Ad Inserter supports functions to insert in-feed ads. Generate Ad unit as described above – select in-feed ads. In most cases you should select Create ad style manually and choose a style that matches your WordPress theme.

ad inserter adsense in feed style

Set additional options, save ad unit and get the code for it. Once you have the code for in-feed ads you can configure Ad Inserter.

In our case we will insert in-feed ads after 2nd and 4th paragraph on homepage. Set Automatic insertion to Between posts, check only Homepage page type and set Filter (button Misc) to 2, 4.

ad inserter adsense in feed ads settings

Save settings and check homepage. Your code should be inserted and ads displayed between posts. However, it may happen that you'll only get blank ad blocks. Check Ads not displayed – troubleshooting section below.

PLEASE NOTE: Automatic insertion between posts works only if your theme is using homepage with standard WordPress hooks that are used by plugins to insert ads. If your theme uses custom homepage you may not be able to insert ads this way.

In-article ads

In-article ads fit seamlessly in between the paragraphs of your pages for an enhanced reading experience. Use settings to insert ads between paragraphs as described for Text & display ads above.

ad inserter adsense in article ads

Auto ads

AdSense Auto ads (known also as Page Level Ads) is a code that you insert on every page once and it will automatically display AdSense ads on positions chosen by the code.

PLEASE NOTE: you can use Ad Inserter to insert code for Auto ads on each page (usually in the header). However, the exact placement of ads will be done by the ad code, not Ad Inserter!

When you enable debugging function Label blocks, AdSense Auto ads will be labeled with a colored bar on the top with a text informing you that the ad was automatically placed by AdSense Auto ads code.

ad inserter adsense auto ads debugging

PLEASE NOTE: Auto ads may not be suitable for some WordPress themes or layouts. In many cases it is easier to place ads at wanted locations by using normal AdSense code and specifying exact locations where the code should be inserted.

To set up Auto ads please check Ad unit section above. Once you choose Auto ads you choose which ad formats you'd like to show across your entire site. These will be your "global preferences" for Auto ads. You can select from a range of ad formats. You then copy and paste the ad code to Ad Inserter.

You'll need to insert the code once on each page that you want to show the ads. You should place your ad code in the <head> tag of your page – go to tab * / tab Header and paste code there – make sure header code is enabled (green button top right). Check also Header and Footer code section. The code for Auto ads looks like this:

<script async src="//"></script>
(adsbygoogle = window.adsbygoogle || []).push({
  google_ad_client: "ca-pub-3424290372640283",
  enable_page_level_ads: true

If you don't want to display ads on every page you can either define custom groups for Auto ads

ad inserter adsense auto ads settings

or insert the code only on specific pages. In such case use any code block, set Automatic insertion to Before Header or Before Post, Alignment and Style to No Wrapping and define rules where the code should be inserted.

AdSense ads on AMP pages

AMP pages need different code for ads. Each Ad Inserter code block can be easily configured to insert different codes on AMP pages - you can use use built-in AdSense code generator to generate code for AMP AdSense code (check also AdSense guide to creating AMP-compatible ad code). Of course, to create AMP pages you also need AMP plugin. The following plugins have been tested with Ad Inserter:

Normally the code configured in code window will not be inserted on AMP pages. There is a setting under Misc/Insertion to enable insertion also on AMP pages. However, this would insert the same code also on AMP pages which may work for image banners but not for AdSense which needs different code. The solution is to separate the codes with [ADINSERTER AMP] separator - the code above the separator will be inserted on normal pages, the code below the separator will be inserted on AMP pages. This separator can be used also for Header and Footer code.

Example for AdSense ads on AMP pages:

ad inserter settings 3

Generating AdSense code for AMP pages

Ad Inserter has a simple code generator for AdSense ads which can be used also to generate AdSense code for AMP pages. Paste normal AdSense code into the code window, click on Code tools button, then on Code generator button and then click on the Import code button to import the AdSense data from it.

ad inserter settings amp code generator

Once you have the Publisher ID and Ad Slot ID imported select ad type for AMP pages. Then click on the generate button and the the plugin will generate code in the code window of the current block.

ad inserter settings amp code generated

AdSense ads need also a script in the header.

<script async custom-element="amp-ad" src=""></script>

Put AMP head script in the Header code block, use [ADINSERTER AMP] separator (the code above the separator will be inserted on normal pages, the code below the separator will be inserted on AMP pages), and enable header code (button with green dot next to PHP button).

PLEASE NOTE: Make sure this script is inserted only once - AMP plugins may also insert this script.

ad inserter settings 3b

Ads not displayed – troubleshooting

There are many reasons why you don't see ads. In order to help you to diagnose the problem Ad Inserter has many debugging functions that can help you to figure out why the ads are not where you expect them.

When you don't see AdSense ads there two basic possible reasons:

  1. Code for AdSense ads is not inserted where you expect it
  2. Code for AdSense ads is inserted but it is not displaying ads – you see blank ad block

Let's first check whether the code is inserted where we expect it. When you are logged in as administrator you'll see admin toolbar above every post or page and there should be Ad Inserter menu item. Go to any post where the ads should be displayed and click on Ad Inserter / Label Blocks in admin toolbar.

ad inserter debugging label blocks

In this example we'll check insertion of AdSense ad before second paragraph. When function Label Blocks is enabled Ad Inserter will put a red frame around each code block so you will see it even if the ad code doesn't display anything. In our case we see that the code block 10 (AdSense Post) is inserted properly (before paragraph 2), however the code doesn't show anything.

ad inserter adsense blank ad block

Blank AdSense ad block means that the code is inserted properly only the ad code doesn't display anything. Typical reasons for this are the following:

  • After the ad code is inserted Google needs some time (hours) to check the pages before it starts to serve ads.
  • AdSense account is not fully approved yet – if your account is new you need to wait until Google checks ad codes on your website and and confirms your account. Usually this takes few days.
  • Your website or page is not approved yet - you need to wait until Google web crawlers check your pages.
  • Your website or page was not approved for AdSense ads
  • Your AdSense account is banned
  • No ads available for your website
  • Errors in ad code – check or regenerate ad code

In case you don't see the red frame with code block number and name (as shown below) this means that the code is not inserted there (before the second paragraph) and you need to check settings. If you are unable to figure out the reason for not inserting the code block you can use debugging function Log Processing which will append the insertion log at the end of each page – switch to page source and at the end of page there should be a log as HTML comment showing settings used, the status of each code block and the reason why it is not inserted. Check Debugging for more.

ad inserter debugging not inserted

When everything is in place you should see AdSense ad before the second paragraph:

ad inserter adsense ad labeled