AdSense Auto Ads Appearing in Footer & Header – How to Avoid?

Google AdSense has a easy way to add ads in website using Auto Ads. It is easy because you only have to put a single code snippet in your header and Auto Ads automatically starts showing ads in your website in relevant place. However Auto Ads also has some disadvantages and it may hurt SEO of your website. Auto Ads in AdSense displays ads in all the sections of a website, like in footer and header and ads may appear anywhere in the website. Having ads in footer and header looks bad and may also make negative impact to your visitors. So here is a little approach on disabling Auto Ads appearing in header and footer of a website.

In Auto Ads in-article ads shows ads in the content/article section. In-article ads works good and have no problem with it so we will disable all in-page ads except in-article ads from Auto Ads. We let Auto Ads work on in-article ads and we will manage other ads as our need and choice.

Steps to disable ads in unwanted positions

Go to Auto Ads and click on pencil icon in right site.

autoads

Disable all in-page ads except in-article ads from Auto Ads. You can enable/disable overlay-ads as your choice.

autoads section

Now Auto Ads in AdSense only shows ads in the article/content section. To add ads in sidebar or any other section in the website create Ad Unit of your choice and add the code snippet in Custom HTML widget in your sidebar.

To create a new Ad Unit go to Ad Units and click on +New Ad Unit.

adunit

If you need Text & Display ads in your sidebar, select Text & Display Ads and customize ads according to your choice.

text & display ads

It is also advised to create a custom channel to improve the ads quality advertiser sends to you. After that click on Save and Get Code to get the code snippet.

create ad unit
adunit code snippet

Copy this code snippet and add to sidebar of your website through Custom HTML widget in Customize.

adunit widget

You can repeat the same process for ads in multiple place in your website.

If you like to completely disable AutoAds then you can also manually insert your AdSense ads inside article. There is a plugin Insert Post Ads, which will make it easy to insert various sized ads after desired paragraphs.

If you like to show advert after each 3’rd or n’th paragraph then you would like – https://sangams.com.np/how-to-insert-advert-after-every-3rd-paragraph-in-wordpress/

If you don’t like to install new plugin, you can do it in code way. You can show ads after second paragraph using the code below as given in WPBeginner. Just copy paste this code inside your theme’s functions.php.

//COPY AFTER THIS LINE
//Insert ads after second paragraph of single post content.
add_filter('the_content', 'prefix_insert_post_ads');
function prefix_insert_post_ads($content)
{
    $insert_after = 2; //change it to change ads position
    $ad_code = '<div>Ads code goes here</div>';
    if (is_single() && !is_admin()) {
        return prefix_insert_after_paragraph($ad_code, $insert_after, $content);
    }
    return $content;
}
// Parent Function that makes the magic happen
function prefix_insert_after_paragraph($insertion, $paragraph_id, $content)
{
    $closing_p  = '</p>';
    $paragraphs = explode($closing_p, $content);
    foreach ($paragraphs as $index => $paragraph) {
        if (trim($paragraph)) {
            $paragraphs[$index] .= $closing_p;
        }
        if ($paragraph_id == $index + 1) {
            $paragraphs[$index] .= $insertion;
        }
    }
    return implode('', $paragraphs);
} 

Change the value of $ad_code to your AdSense code and the value of $insert_after to change paragraph after which ads should appear.

If have any problem or idea on this let me know through comment below.

This Post Has 18 Comments

  1. Brian Klein

    Thanks for the article, but it is not working for me. I have annoying ads that are above the fold on mobile. The ad that I want to remove is not actually in the header, it is directly below the menu bar on mobile.
    I think this ad is giving me a high bounce rate. I turn off all auto-ads but it still appears. I tried clearing the cache also. How long does it take for the changes to take effect after turning off all auto-ads? It has been about 15 minutes and the annoying ads are still there.
    Here is a link to my website. Hopefully, I will have the problem fixed before you read my comment. https://hospitalitytrainingcenter.com/
    Thanks!

    1. Brian Klein

      I solved the problem. My comment is still held for moderation. You can delete the comment if you like. Your choice.
      I read the Google AdSense documentation again about where to put the code snippet in header.php file. It says that I can put the snippet in the section or at the top of the section.
      I had the snippet in the top of the section. I moved the snippet to the section and now that annoying ad is gone!

      1. Sangam

        Actually you don’t need to edit header.php directly, things may break. I use widgets (HTML) to display ads in my site.

  2. Dr. Sanjay

    Sangam thank you for this article
    Query
    http://www.eduroost.com
    Placed auto ads . overlay ads are displaying on mobile only . No ad on desktop. Please see my site .
    Adsense says place ad code where you want to show ads . Should I place on every page and posts .
    If yes from where I can open html file for each page and post in html.
    I am very much new please help .
    Asked so many people but no ans.
    With regards

    1. Sangam Shrestha

      Auto ads will show ads automatically whether it is mobile or desktop. Answer of second question about putting AdSense code depends on your website. It is easy to implement AdSense code in dynamic sites built with PHP like WordPress. Where plugins can help to add code in the header of every page dynamically. If it is static site built with HTML then you have to put AdSense code in every page you want to show ads.

      1. snjay

        thank u so much dear sir, at last, I got a response from anybody.
        I am just a layman for all this.
        I have a wp site.
        I pasted the auto code in the header section of the theme. is it enough?
        After more than 15 days only anchor and vignette ads showing on mobile and no ads on desktop
        I don’t have an AMP version . is it necessary for auto ads.
        using Astra theme

        1. Sangam Shrestha

          No, if you have enabled auto ads then after adding ads code in header you don’t need to do anything.

  3. MAC

    Is there any option to show sticky ads on mobile site and footer only.

    1. Sangam Shrestha

      Sticky ads violates Google AdSense policy. You can use plugins for cms you are using.

  4. ShaneMcDonald

    Great Post – this started happening to me, I was not happy. So I was able to solve it quickly. Thanks

  5. Mindsetboosting

    Hey super thanks for this helpful blog ?. Since my ads are only displayed on the URL website https://www.mindsetboosting.com/blog/, but unfortunately the articles there were always covered by the ads, your article helped me to get rid of the annoying ads! Many thanks Sangam

    1. Sangam Shrestha

      I am not seeing any ads in your website or blog. If you are doing this for backlink, it is not gonna work because Google is smarter than you are thinking.

    1. Sangam Shrestha

      Yes, it puts ads anywhere in a page makes the whole content dumb.

  6. Adam Muiz

    If i do that, will lost page level ads setting. i mean floating adsense on mobile view?

    1. Sangam Shrestha

      No it will not disable floating ads since it is overlay-ads and you can turn it on/off independently.

Leave a Reply to Brian Klein Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.