Ad Inserter – AdSense plugin, WP Ads, Header Code


Ad management plugin with many advanced advertising features to insert ads at optimal positions.

Supports all kinds of ads including Google AdSense ads, contextual Amazon Native Shopping Ads, ads and rotating banner ads.

This plugin is more than AdSense plugin or plugin for ads. It provides many advanced options to insert opt-in forms, header scripts, AMP ads, Javascript, CSS, HTML, PHP, analytics, tracking or advert code anywhere on the page.

Ad Inserter can insert ads where other plugins fail.
It’s all about the settings.

Average Rating: 5 out of 5 stars – check Ad Inserter reviews

One of the best adsense plugins
Most comprehensive Ad plugin available
Better than the old Google adsense plugin
The best WP Ad management plugin
Very flexible and excellent documentation
Excellent Ad Plugin
Easy to use and also does more than I need
Exactly what I needed to sell advertising spots
Awesome Plugin and Super Support!
Lots of options and easy to use
Crazy flexible
Great plugin that makes it simple
Superb Plugin and Support team also so good
Best in same kind of plugins
Must Have Plugin for Each WP Site
Best Ad Placement Plugin
Best Solution for Advertisement Management
Comprehensive, flexible and well supported
God bless these guys!
PRO for Free

Looking for AdSense plugin with simple setup for ads at best positions? A plugin for Amazon ads and Google Analytics code in the header?


  • Enable AdSense integration and get powerful AdSense plugin
  • Syntax highlighting editor
  • Code preview with visual CSS editor
  • Automatically inserts ads on posts and pages
  • Insert ads before or after post
  • Insert ads before or after content
  • Insert ads before or after paragraph
  • Insert ads before or after random paragraph
  • Insert ads before or after multiple paragraphs
  • Insert ads before or after comments
  • Insert ads before or after excerpt
  • Insert ads near any element on the page (using CSS selectors)
  • Insert ads above the header (after <body> tag)
  • Insert ads in the footer (before </body> tag)
  • Insert ads at relative positions in posts
  • Insert ads between posts on blog pages (in-feed AdSense ads)
  • Insert ads between excerpts on blog pages
  • Insert ads between comments
  • Insert ads at custom hook positions (do_action () WP function)
  • Avoid inserting ads near images or headers (AdSense TOS)
  • Disable ads on individual posts or pages
  • Insert header (<head> section) and footer code
  • Insert raw HTTP response header lines
  • Insert Google Analytics, Matomo (Piwik) or any other tracking code
  • Insert HTML, CSS, Javascript or PHP code
  • Code generator for banners and placeholders
  • Visual advert editor – create ads from scratch
  • Manual insertion: widgets, shortcodes, PHP function call
  • Sticky (fixed) widgets (sticky sidebar – the sidebar does not move when the page is scrolled)
  • Custom alignments and styles for ads
  • Insert ads (different ad code) on AMP pages
  • Custom CSS class name for wrapping divs to avoid ad blockers
  • Use shortcodes from other plugins
  • Use custom fields as defined in posts
  • Use post title, tags or category names to create contextual ads
  • PHP code processing
  • Ad labels – show customized label above ads
  • Ad rotation (server-side and client-side – works with caching)
  • Timed ad rotation – define times to rotate ads in a single ad block
  • Create rich media ads with standard WordPress TinyMCE editor
  • Ad blocking detection – popup message, page redirection
  • Desktop/mobile device detection (server-side and client-side – works with caching)
  • Black/White-list categories, tags, taxonomies, post IDs, urls, url query parameters, cookies, referers
  • Easy copying and pasting ads or settings using internal clipboard
  • Simple troubleshooting with many debugging functions
  • Function to visualize inserted code blocks and ads
  • Function to visualize available insertion positions
  • Function to visualize HTML tags
  • You name it 🙂

Ad Inserter review on WP Mayor

The Best WordPress Ad Management Plugin?

Ad Inserter review on ShoutMeLoud

Both Google and Amazon recommend this plugin for inserting ads, which is a testament to its quality

Endorsed by Google

Google lists Ad Inserter plugin as possible solution to place code for AdSense ads into your WordPress site.

Ad Inserter is a perfect plugin to place code for Google AdSense ads at top positions for optimal monetization of your website: ordinary AdSense ads (ad units), AMP ads, Auto ads (page level ads), In-feed ads, in-article ads, responsive ads, AdSense ads that need page-specific header code, etc.

If you’re new to AdSense, one of your first tasks is to connect your site to AdSense. This requires you to copy the code on your AdSense homepage and paste it into the HTML of your page, between the <head> and </head> tags.

Check How to insert ad code in your WordPress site. Advanced users can enable AdSense integration: import AdSense ads from the plugin settings page – no need to copy codes for AdSense ads from the AdSense admin pages. List ad units, preview AdSense ads and get ad codes where you need them.

Endorsed by Amazon

Amazon suggests to use Ad Inserter to add Native Shopping Ads to WordPress posts.

Native Shopping Ads provide highly relevant and dynamic product recommendations in a stylishly designed and responsive ad unit that can be placed at the end of your content or within your content to create a more compelling visitor experience and shopping opportunity.

Check WordPress Integration Guide for Native Shopping Ads. Ad Inserter supports also advanced contextual ads: check settings for contextual Native Shopping Ads that show ads with items related to the post content (using post tags).

And if you need more ads with page/category specific settings, ad statistics and metrics for impressions and clicks, A/B testing, lazy loading ads, sticky ads, slider ads, pop-up ads, geotargeting or geolocation to serve country-specific ads, functions to protect content from users using ad blockers, functions to serve different ads for users using ad blockers, multisite options to limit settings for ads, to block some IP addresses, to schedule ads, there is Ad Inserter Pro – all-in-one WordPress ad management plugin with many advanced features:

  • 64 code (ad) blocks (64 different insertion configurations for ads)
  • Geolocation using Webnet77 or MaxMind databases (works also with caching)
  • Black/White-list IP addresses or countries (works also with caching)
  • Ad impression and click statistics (works also with <iframe> Javascript ads like Google AdSense)
  • External tracking via Google Analytics or Matomo (Piwik)
  • A/B testing – discover ads and settings that perform best
  • Lazy loading ads
  • Sticky ads with optional close button
  • Sticky sidebar ads (stick to the screen or to the content)
  • Floating slide-in banner ads
  • Sticky (floating) ads with animations (fade, slide, turn, flip, zoom)
  • Animation trigger for sticky ads (page scroll in % or px, HTML element becomes visible)
  • Scheduling with fallback option
  • Ad blocking detection – replace ads, protect content
  • Ad blocking statistics
  • Multisite options to limit settings on the sites
  • Individual post/page exception management
  • More custom viewports for client-side desktop/mobile device detection
  • More custom hooks for custom theme insertions
  • Export and import of settings
  • No ads on the settings page
  • Support via email

Run a WordPress related blog? Have experience with AdSense ads? Interested in reviewing Ad Inserter Pro? Introduce yourself.

Ad Inserter WordPress plugin is an advanced advertising manager for all kind of ads – it has many features and options to automate placing ads in order to optimally monetize your website on desktop, tablet and phone displays. It provides many simple ways to insert any kind of ads, Javascript, HTML, PHP or advert code anywhere on the page. For best placement of ads please read the user manual to get the most of the plugin.

Check Ad Inserter documentation pages for detailed description of all the features and some common settings for quick start

You can also use shortcodes from other plugins (for example, to insert ads from other ad plugins like AdRotate, Advanced Ads, Quick Adsense, AdSense Plugin WP QUADS, Insert Post Ads).

Ad Inserter can insert ads where other plugins fail.
It’s all about the settings.

Ad Inserter – WordPress Ad Manager

One Plugin for All Ads

Ad Inserter is not just another plugin for WordPress ads. Do you enjoy finding the right plugin to solve a particular problem on your site? For example:

  • for ad management and ad injection
  • to insert Google AdSense ads or ads
  • to insert Amazon Native Shopping ads
  • to insert affiliate ads (CJ Affiliate by Conversant, ClickBank, ShareASale, Rakuten LinkShare, etc.)
  • to insert ads between paragraphs
  • to insert ads between posts
  • to insert ads between comments
  • to insert ads on custom posts
  • to insert AMP ads on AMP pages
  • to insert different ads for mobile devices
  • to insert ads at custom action hooks (e.g. using Genesis Theme Framework Hook Guide)
  • to hide ads on specific pages
  • for ad rotation – to rotate different ads in a single ad position
  • for PHP code widgets
  • for sticky (fixed) widgets
  • for widget logic
  • to restrict widgets
  • to detect ad blocking
  • to insert banner ads
  • to insert PHP or HTML code into posts
  • to insert PHP ads
  • to insert tracking, footer or header code
  • to insert PHP, HTML, CSS, shortcodes
  • to insert Google analytics code
  • to insert various opt-in forms (MailChimp, AWeber, GetResponse, etc.)

Maintaining several plugins (often from different vendors) is not easy. And each plugin is slowing down the speed of your website.

Speed Up Your WordPress: Replace them all with free Ad Inserter!

Quick Start

To become familiar with the plugin check Quick Start to display ads on your website. Few important steps:

  • Completely disable AdBlocker! You don’t need it when working with ads! Ad blockers prevent displaying ads and also block all AdSense pages!
  • Code block is any code (for example for Google AdSense ads) that has to be inserted (and displayed) at some position. Each code block can be configured to insert code (or ads) at almost any position supported by WordPress
  • To rename block click on the name
  • If you are using AdSense ads check available tools and code generator for AdSense ads
  • Paste ad code into the code window or use code generator to generate code for banners, AdSense ads or any other HTML advert
  • Enable and use at least one insertion option (Automatic insertion, Widget, Shortcode, PHP function call)
  • Enable insertion on at least one WordPress page type (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages)
  • For Posts and Static pages leave default BLANK selection value after the checkbox unless you really know what are you doing (using individual exceptions)
  • If you don’t see inserted blocks or ads, turn on debugging functions: Label inserted blocks, Show available positions for automatic insertion (Ad Inserter menu item in the WordPress admin toolbar on the top of every post/page when you are logged in). Check Troubleshooting documentation for details.
  • If you are using AdSense ads you may get blank (empty) ad blocks – no ads are displayed. This might happen because there is some error in the code (wrong IDs), your Google AdSense account is not fully approved yet, your website was not accepted or your Google AdSense account is banned. In such case you can try other ad networks for contextual ads. Check Ads Not Displayed for more information.

Few typical settings are described on the Common Settings page. Please make sure you have also read plugin installation documentation. For more detailed instructions please read Ad Inserter documentation pages.

Insert Any Code Anywhere on the Page – Automate Insertion of Ads

  • Automatic insertion using standard WP hooks (the_content, the_excerpt, loop_start, loop_end, the_post,…)
  • Automatic insertion using custom WP hooks provided by themes (e.g. using Genesis Theme Framework Hooks)
  • Server-side or client-side (javascript) insertion before or after any HTML element on page (using selectors #id, .class)
  • Manual insertion with shortcodes
  • Insertion with widgets
  • Insertion by placing PHP function calls or custom hooks in your theme files

Ad Inserter is the only WordPress plugin that can insert any code or ads anywhere on the page. If standard insertions before/after post, content or paragraph can’t be used, you can use advanced insertion before/after arbitrary HTML element.

If you can create a CSS slector for the page element (#id, .class) then you can insert ads before or after that element. By default this approach uses client-side insertion using Javascript to insert code block after the page loads.

However, if you enable Output buffering (tab ⚙ / tab General) you can select also Server-side insertion which will insert code block the same way as other insertions when the plugin is called and the page is created.

Please note that Output buffering may not work with all themes – in such case you can still use client-side insertion.

Please support plugin development

If you are using Ad Inserter and you like it, then please write about it and spread the word on the review page.

Positive reviews are a great way to show your appreciation for my work. Besides being an incredible boost to my morale, they are also a great incentive to fix any bug found in the software and to add new features for better monetization of your website.

Support the advancement of this plugin:

  • Write a short review
  • Donate if Ad Inserter helps you to make money with ads
  • Buy license for Ad Inserter Pro – Top WordPress plugin for ads


  • Settings for one code block (Before content). Up to 16 blocks can be configured (up to 64 in Ad Inserter Pro)
  • Code preview with visual CSS editor
  • Code preview with visual CSS editor - highlighted code
  • Post / Page Ad Inserter Individual Exceptions
  • Some Ad Inserter Pro features: IP address and country lists, Scheduling between dates with fallback
  • Ad Inserter plugin settings
  • Visualization of HTML tags in post
  • Visualization of positions for automatic insertion in post
  • Visualization of inserted block in post
  • Automatic insertion, Alignment and Style settings
  • Rotation code editor and banner code generator
  • Settings for automatic insertion before/after paragraphs
  • Settings for custom hooks
  • Settings automatic insertion at custom hook positions
  • Settings ad blocking detection
  • AdSense code generator
  • Complete settings for one code block (Before Paragraph)


Using The WordPress Dashboard

  1. Go to WordPress Plugins menu, click Add New button
  2. Search for ad inserter
  3. Click ‘Install Now’
  4. Activate Ad Inserter on the Plugins dashboard

Uploading plugin file

  1. Go to WordPress Plugins menu, click Add New button
  2. Click Upload Plugin
  3. Select from your computer
  4. Click ‘Install Now’
  5. Activate Ad Inserter on the Plugins dashboard

Using FTP

  1. Download
  2. Extract ad-inserter directory to your computer
  3. Make sure ad-inserter directory contains plugin files and not another ad-inserter directory inside
  4. Upload ad-inserter directory to the /wp-content/plugins/ directory
  5. Activate Ad Inserter on the Plugins dashboard

Ad Inserter Pro Installation

If you are using free Ad Inserter then first uninstall it. The Pro version will automatically import existing settings from the free version.
After you receive the email with download link for the Ad Inserter Pro plugin, download it, go to WordPress Plugins, Add New, Upload Plugin, Choose file, click on Install Now,
activate it and then click “Enter License Key” and enter license key you got in the email.


If you deactivate and delete Ad Inserter, the settings will stay in the database. To completely remove the plugin and settings do the following:

  1. Go to Ad Inserter general settings (tab ⚙) and click on Reset All Settings
  2. Go to Ad Inserter general settings (tab ⚙) and click on Clear All Statistics Data (Pro only)
  3. Deactivate Ad Inserter
  4. Delete Ad Inserter plugin

Please Note

Ad Inserter inserts only the code you configure (blocks 1 – 16, Header, Footer). The code you see is the code that will be inserted (+ some internal scripts for plugin features).
When you deactivate Ad Inserter it can’t insert anything as WordPress doesn’t call it. If you still see ads please clear all the caches and check page source code before you make any conclusion.
Of course, if you configure code block with some javacript ad code, then this code may generate ads. But please, don’t blame the plugin for this.
You can also use Ad Inserter to insert code for AdSense 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!

The easiest way to check Ad Inserter code blocks or ads is to use Label blocks debugging function:

When you deactivate Ad Inserter it can’t insert anything – WordPress doesn’t call it. If you still see some ads that were inserted by Ad Inserter, make sure you have cleared all the caches.
If you still see those ads after you have disabled Ad Inserter and cleared all the caches, then the ads were not inserted by Ad Inserter.

Online Documentation


I have activated Ad Inserter. How can I use it?
  1. After activation, click “Settings / Ad Inserter” to access the settings page
  2. There are 16 code blocks – each block means ad code at some position (or multiple positions in some cases)
  3. Put ad (or any other HTML/Javascript/PHP) code into the code window
  4. Set automatic insertion option (for example: Before Post)
  5. Enable at least one page type (for example: Posts, some insertion options don’t work on all page types)
  6. Save settings
  7. Check also common Ad Inserter settings
  8. Check inserted code on the posts
  9. Ads are not showing? Check troubleshooting guide to find out what to check to fix the problem.
Does Ad Inserter insert any internal ads?

No revenue sharing and no such thing as “internal ads” or “our ads” on your website. Period. What you configure is what will be inserted (+ some internal scripts for plugin features).
Ad Inserter is free, open source plugin and inserts only the code you configure (blocks 1 – 16, Header, Footer). The code you see is the code that will be inserted. Please check page source code before you make any conclusion.
Of course, if you configure code block with some javacript ad code, then this code may generate ads. But please, don’t blame the plugin for this.
You can also use Ad Inserter to insert code for AdSense 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!

The easiest way to check Ad Inserter code blocks is to use Label blocks debugging function:

I have installed code for AdSense ads and I see ads placed at random positions.

You are probably using code for AdSense 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.
Auto ads use Google’s machine learning to pick the best placements on your pages to show ads. You only need to add one piece of code to all your pages, and let Google take care of the rest.

Auto ads may not be suitable for some WordPress themes or layouts. In such 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.

I have installed code for AdSense ads but the ad blocks are blank.

Blank AdSense ad block means that the code is inserted properly only the ad code doesn’t display ads. 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
  • You are using ad blocker

In such case you can try other ad networks for contextual ads. Check Ads Not Displayed for more information.

What is GDPR?

The GDPR (General Data Protection Regulation) is a regulation in European Union (EU) on data protection and privacy for all individuals within the EU and the European Economic Area (EEA) that was designed to harmonize data privacy laws across Europe. If you collect personal information from any EU citizen (within or outside the EU), you must first obtain explicit and unambiguous consent.

GDPR compliance: What cookies does the plugin use

Ad Inserter itself does not use cookies except for ad blocking detection when you use delayed action.

In this case 3 cookies may be used (to store pageviews and action settings): aiADB, aiADB_PV and aiADB_PR. However, no personal data is stored in the cookies.

Of course, the ads you may insert with the plugin may use own cookies – please check with ad networks for details.

How to display a GDPR compliant cookie message?

You can use any plugin for GDPR compliance / cookie consent. For example:

PLEASE NOTE: Installing GDPR plugin alone does not make your site GDPR compliant. Since ads you insert may use various cookies, you may need to make sure you have necessary configurations in place. Please check next question regarding showing ads based on visitor’s consent.

How to show ads based on visitor’s consent?

Ad Inserter supports inserting (showing) ads based on cookies or cookie values. You can define cookie conditions by black/white-listing Url parameters (where also cookies are checked).

PLEASE NOTE: If you are using caching (very likely) you also need to set Dynamic blocks to Client-side insert (tab ⚙ / tab General) in order to check cookies in visitor’s browser and not when the page is generated.

For example, If you are using one of the following plugins for cookie consent you need to white-list the following cookie and value in Url parameter list:

Settings for widget ads
  • Nothing needed, just enter the code for ads and save settings – widget is enabled by default
  • Go to Appearance / Widgets, drag Ad Inserter widget to the sidebar or any other widget position, select block and click on Save (button Save might be disabled until you make some change)
  • Optionally you can enable Sticky widget – this means that this widget (and widgets below) will stay fixed in the sidebar when the page is scrolled – Sticky sidebar or Fixed widget feature
  • You can also make other widgets sticky even if you don’t use Ad Inserter ads – drag Ad Inserter widget to the sidebar ABOVE the top widget that needs to be sticky, select Dummy Widget for Block, check Sticky and save widget
  • In general plugin settings (tab ⚙) you can also define Sticky Widget Top Margin to precisely define top position where the first sticky widget will stick

Additional note regarding Sticky WidgetsSticky Sidebars:

There are two modes for sticky widgets (or sticky sidebars) available as Sticky widget mode in general plugin settings (tab ⚙):

  • CSS mode – This mode is the best approach but may not work with all themes. CSS mode works by changing sidebar CSS to position: sticky. This works with most themes but not all. If your widgets and sidebar aren’t sticking as expected you can use JavaScript mode described below.
  • JavaScript mode – This mode should work with practically all themes but may reload ads on page load when sticky sidebar is initialized.
Settings for contextual Amazon Native Shopping Ads
  • Automatic Insertion: After Content
  • On all Posts checked, other page types unchecked

Sign in to Amazon Associates, go to Widgets/Widget Source, choose ad type and set parameters.
For titles and search terms use tags. For example, the code below would display amazon products related to the post tags – check documentation for all possible tags.

<script type="text/javascript">
amzn_assoc_placement = "adunit0";
amzn_assoc_search_bar = "true";
amzn_assoc_tracking_id = "ad-inserter-20";
amzn_assoc_search_bar_position = "top";
amzn_assoc_ad_mode = "search";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_title = "Search Results from Amazon";
amzn_assoc_default_search_phrase = "[adinserter data='smart-tag']";
amzn_assoc_default_category = "All";
amzn_assoc_linkid = "cf1873f027a57f63cede634cfd444bea";
<script src="//"></script>

Use your own tracking id! Please note [adinserter data='smart-tag'] as default search phrase. This makes this widget contextual. It will show products related to the tags for this post.

You can also use custom fields to make the widget contextual. For example, if you define in posts custom field named amazon-keyword you can use [adinserter custom-field='amazon-keyword']' foramzn_assoc_default_search_phrase` variable.

You can also try with [adinserter data='tag']',[adinserter data=’short-title’],[adinserter data=’category’]or[adinserter data=’short-category’]`. For more options check Ad Inserter documentation page.

Settings for ads …

Check common Ad Inserter settings

What PHP versions are supported?

Officially PHP 5.6 and higher versions up to PHP 7.2 are supported. However, Ad Inserter should work also with older PHP versions supported by WordPress.
Some plugins like PHP Compatibility Checker may report warnings with PHP 7.2 because they check also files that are loaded only for older PHP versions.

I wish to show ads side by side but not in the same block. How do I do this?

Configure block 1 and 2 with ads using:

  • Automatic Insertion: Disabled
  • Block Alignment and Style: No Wrapping
  • Enable shortcode: checked

Configure block 3 with

[adinserter block="1"]
[adinserter block="2"]

Use block 3 to insert ads and make sure all 3 blocks are enabled for the same page types (Posts, Pages, Homepage, etc.).

I use After Content insertion position but the ads are inserted after the stuff provided by other plugins. How can I insert ads directly after post content?

This happens because Ad Inserter processes posts last and therefore “sees” also content added by other plugins.

Try to set Ad Inserter plugin priority to 10 (early processing, Ad Inserter settings – tab ⚙ / tab General).

How can I add some title or label (e.g. Advertisements) above the ads?

If this is a sidebar widget then you can simply name the widget.

For each code block you can also show a label above each ad. Default text (or HTML code) for ad labels can be set on the general plugin settings tab (tab ⚙ / tab General / Ad label.
To enable ad label above the ad go to code block for this ad, click on the Misc button and then on the Display tab check Ad label.

If you configured only text for ad label then the following code will be added above ad code: <div class="code-block-label">AD_LABEL_TEXT</div> (code-block is the block class name used, AD_LABEL_TEXT is the text for Ad Label).
You can then style the label using CSS for class .code-block-label (the best place for this code is Header section). If HTML code is configured for ad label then this code will be used (instead of the div code above).

In case you need a different label for some ad you can simply add label HTML code above the ad code. For example:


How can I enable/disable ads on specific posts/pages?

There are two possible approaches.

  • Approach with page/post exceptions – use this one if there are many exceptions (more than two):
  1. Go to Ad Inserter settings page and define default insertion options for post/page.
  2. Enable automatic insertion on posts/pages and choose default insertion: Individually disabled or Individually enabled.
  3. Save settings.
  4. Go to post/page editor and open Ad Inserter Individual Exceptions meta box below.
  5. define insertion exceptions for this post or page.
  6. Save post/page.

Individually disabled means that insertion will be by default enabled on all posts (according to the settings for this code block), but you will be able to disable insertion on individual posts or pages (in post/page editor).

Individually enabled means that insertion will be by default disabled on all posts, but you will be able to enable insertion on individual posts or pages (in post/page editor) – of course, other settings (e.g. lists) for this code block will also apply.

  • Approach with code block settings only – use this one if there are only few exceptions:
  1. Go to Ad Inserter settings page and define default insertion options for post/page.
  2. Enable automatic insertion for Posts/Pages (use default value after checkbox – blank selection means no individual exceptions).
    3a. Click on Lists, enter post IDs (click on the button left of the list) and white-list or black-list them.
    3b. Click on Lists, enter url (or comma separated urls) for Urls, e.g. /permalink-url, and white-list or black-list it.

For details check Individual Post/Page Exceptions.

I’m using responsive theme. How can I show or hide some ads on mobile devices?

Select device types (desktop, tablet or phone) for which you need to show ads and enable only client-side device detection.

How can I enable or disable ads on group of similar pages?

If those pages have something in common in the url (page address) then you can block them with url patterns.
Use * to define url pattern to whitelist (enable) or blacklist (disable).

  1. To filter all urls starting with /url-start use /url-start*
  2. To filter all urls that contain url-pattern use *url-pattern*
  3. To filter all urls ending with url-end use *url-end

For example, to exclude ads on pages that have /shop/ in url (page address) blacklist the following url: */shop/*

How can I put ads in the middle of the post regardless of the number of paragraphs?

Use Before paragraph automatic insertion and put 0.5 as paragraph number. Value between 0 and 1 means relative position in post or page (e.g. 0.3 means paragraph 30% from top or bottom)

How can I put ads before the second paragraph and also in the middle of post with single ad block?

Use Before paragraph automatic insertion and put 2, 0.5 as paragraph number. You can specify multiple paragraphs as comma separated paragraph numbers (or relative postions).

I’d like to rotate my ads based on percentage, for example show one ad 75% of the time and another one 25% of the time. Is that possible?

Yes. Either use rotation code generator and define shares in percents or create code using ROTATE separator with attribute share where you define percentage of the rotation share:


If you omit one share value it will be automatically calculated:

How can I show different ads to different visitors according to a url query parameter?

Use Url parameters List to black/white-list certain url parameters. Leave url parameter list empty and set it to Black list to show ads for all url.
You can specify either parameters or parameters with values. For example for url you can define url parameters ‘data, customer-id=22‘ to insert ad only for urls where there is data parameter and customer-id parameter with value 22.
Separate parameters with comma.

How can I use PHP code for code block?

Enter PHP code surrounded by PHP tags and check Process PHP.

<div style="width: 100%;">
Some HTML/Javascript code
<?php echo "PHP code by Ad Inserter"; ?>
How can I rotate few versions of the same ad?

Enter them into the ad box and separate them with [ADINSERTER ROTATE]. Ad Inserter will insert them randomly.

What settings should I use for ads on AMP pages?

Normally the code will not be inserted on AMP pages. There are two settings that can be used to insert code on AMP pages:

  1. AMP pages checkbox in Misc / Insertion section – If checked it enables insertion also on AMP pages. Use this approach only if you need to insert the same code on normal and AMP pages. To insert different codes on AMP pages use [ADINSERTER AMP] separator as described below.
  2. 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.

The following AMP plugins have been tested with Ad Inserter:
* AMP for WP – Accelerated Mobile Pages (free)
* AMP (free)
* WP AMP Ninja (free)
* WP AMP – Accelerated Mobile Pages for WordPress (paid – you need to uncheck Remove third-party the_content hooks for better compatibility)

For details check settings for ads on AMP pages.

How can place ads below Read More tag?

Configure ad block with the following options:

  • Automatic Insertion: After Paragraph
  • Paragraph Number: 1
  • Count only paragraphs that CONTAIN: <span id="more-

Check source code of your website for proper “read more” tag.

How can I insert ads or code block directly into template php file?

Enable PHP function adinserter for code block and call adinserter function with code block number as parameter.
Example for block 3:

<?php if (function_exists ('adinserter')) echo adinserter (3); ?>

This would generate code as defined for the code block number 3. Before you modifu theme files it makes sense to create a child theme first.

Center alignment does not work for some ads!

Some ads can not be centered using the standard approach so some different CSS code is needed to put them in the middle.

In Preview window you can try alternative CSS code for centering the ad. Double-click on the icon for Center alignment and the code will toggle. The current code version is displayed next to Alignment and Style selection.

How can I rotate between different alignments so I can test an ad aligned to the right against an ad aligned to the left?

Set Block Alignment and Style to “No Wrapping” and create manual wrapping around both ads separated with [ADINSERTER ROTATE]:

<div style="float: left; margin: 0 8px 8px 0;">


<div style="float: right; margin: 0 0 8px 8px;">


It works!

This plugin saves a lot of time placing ads. Works the way it’s supposed to.

Works great

Does everything it has said. Plan on purchasing full plan as soon as ad revenue comes in.

Mostly effective

Simple, easy ad inserter. Biggest challenge is the ad insertion applies to all post types universally. If you are using multiple post types (woocommerce, custom post types, etc) your settings will apply to every single post regardless of type. The solution will be to assess where you want ads inserted and then figure out whether you have more of those post types and the use manual settings for the smaller amount of posts.


Ottimo plugin, permette in maniera comoda ed intuitiva di inserire ogni tipo di banner, dando la possibilità di scegliere anche su quale tipo di device inserirlo.
Peccato non esista la versione in Italiano, comunque è di facile utilizzo.



Ad Inserter – AdSense plugin, WP Ads, Header Code はオープンソースソフトウェアです。以下の人々がこのプラグインに貢献しています。


“Ad Inserter – AdSense plugin, WP Ads, Header Code” をあなたの言語に翻訳しましょう。

開発に興味がありますか ?

コードを閲覧するか、SVN リポジトリをチェックするか、開発ログRSS で購読してみてください。



  • Improved code for client-side insertion
  • Added support for usage tracking
  • Fix for compatibility with older PHP versions (below 5.4)
  • Few minor bug fixes, cosmetic changes and code improvements


  • Added option to force showing admin toolbar when viewing site
  • Added additional debugging info for blocks in Ajax requests
  • Fix for viewport visibility detection
  • Fix for rotation with non-ASCII characters
  • Few minor bug fixes, cosmetic changes and code improvements


  • Improved loading of settings
  • Fix for content processing in some ajax calls
  • Few minor bug fixes, cosmetic changes and code improvements


  • Improved code for client-side insertion
  • Fix for rotation with shortcodes
  • Few minor bug fixes, cosmetic changes and code improvements


  • Added support to schedule insertion for N days after publishing
  • Added support to schedule insertion only for posts published inside/outside time period (Pro only)
  • Added support to prevent activation of free Ad Inserter while Pro is active
  • Added url parameter to show block code
  • Improved Header/Footer code debugging
  • Few minor bug fixes, cosmetic changes and code improvements


  • Added shortcode for ad blocking detection action
  • Few minor bug fixes, cosmetic changes and code improvements


  • Added option to insert block only when WP loop is currently active
  • Added support for Better AMP plugin
  • Code generator for placeholders on https sites now generates https urls
  • Optimized loading of plugin settings
  • Few minor bug fixes, cosmetic changes and code improvements


  • Fix for insertion on AMP pages


  • Simplified AdSense integration
  • Added setting to define maximum number of blocks (ads) per page
  • Optimized the_content filter processing
  • Added setting for lazy loading offset (Pro only)
  • Fix for url parameter list when using client-side dynamic blocks
  • Few minor bug fixes, cosmetic changes and code improvements


  • Added support for lazy loading (Pro only)
  • Fix for unwanted insertions with some paragraph settings
  • Few minor bug fixes, cosmetic changes and code improvements


  • Fix for urlencode error
  • Few other minor bug fixes


  • Added support for W3TC/client-side check for cookies (in url parameter list) to support showing ads based on visitor’s cookie consent
  • Added support for W3TC/client-side check for referers
  • Improved paragraph processing
  • Few minor bug fixes, cosmetic changes and code improvements


  • Added support for timed rotation
  • Added support for client-side insertion of dynamic blocks
  • Improved word count function
  • Few minor bug fixes, cosmetic changes and code improvements


  • Added option to easily disable insertion of individual code block
  • Changes for compatibility with PHP 7.2
  • Added non-interaction parameter to external tracking (Pro only)
  • Few minor bug fixes, cosmetic changes and code improvements


  • Added support for rotation option shares
  • Added support for sticky ad settings and animations (Pro only)
  • Few minor bug fixes, cosmetic changes and code improvements


  • Added support for ad labels
  • Blocked search indexing while debugging
  • Close button setting moved to tab Display (Pro only)
  • Few minor bug fixes, cosmetic changes and code improvements


  • Added widget for debugging tools
  • Fix for AdSense ad overlays not displayed with some themes
  • Few minor bug fixes, cosmetic changes and code improvements


  • Added display of header and footer code in Label blocks debugging function
  • Added AdSense ad overlays in Label blocks debugging function (experimental)
  • Fixed bug for removed square brackets in HTML element selectors
  • Fixed preview of AdSense ad units
  • Few minor bug fixes


  • Added support for author:author-username items in taxonomy list
  • Fixed errors when downgrading from Pro
  • Few minor bug fixes


  • Added list editors
  • Added Label blocks debugging function for AdSense Auto ads


  • Added AdSense code generator for ad sizes using CSS media queries
  • Fix for slow updates caused by changed user agent (Pro only, credits Olivier Langlois)
  • Fix for client-side insertion of non-English characters before/after HTML element


  • Added support for server-side insertion before/after any HTML element
  • Few minor bug fixes


  • Added support for client-side insertion before/after any HTML element
  • Inplemented AdSense integration
  • Added option to define close button position
  • Fix for code generator import and code preview error with non ASCII characters
  • Fix for post/page exceptions and page types not processed in the header
  • Fix for close button in preview window
  • Fix for errors when rearranging blocks
  • Fix for errors when importing code
  • Few minor bug fixes, cosmetic changes and code improvements

Earlier versions

For the changelog of earlier versions, please refer to the separate changelog.txt file.