Hello welcome back to 9jaedublog.com.ng, I know you have been looking for way to do this as AdSense now dishes out ads serving limits real quick and this is because you are showing Ads on little to nothing content pages according to their policy.
This tutorial is for Blogger blogs/websites but can still be applied to other hosts like Wordpress website/blogs.
{tocify} $title={Table of Contents}
One major problem with AdSense, that some blog owners have reported, is that AdSense ads are not permitted on pages with very little AdSense relevant content as I earlier mentioned.
Unfortunately for some blog owners, the responsibility for preventing this is left to the blog owner, in this post I will teach you how you can easily do that, this is not via blocking ads via page exclusion on your auto ads page. No! that doesn't work for Ads Unit as it only applies to auto ads.
Blogs with static pages, and AdSense gadgets in the sidebar or HTML code you manually added the ads unit code, are a problem here. Static pages with little blog relevant content - such as label indexes, expanded owner profiles, special gadgets like Followers displays - cause problems with the AdSense ad classifier - and can cause blogs to lose ads account or be on suspension for long period of time.
As an AdSense publisher, the blog owner is expected to ensure that ads are not displayed on unsuitable blog pages. I contacted AdSense theme and some experts review my site as for why is my ads limit restriction is taking so long to lift, and they responded after thorough review.
They told me they found the ads code and ads on pages with little to no content, such as contact us page which just have a form to send messages, that I should consider removing the ads code.
So I thought about how do I remove the Ads code from this pages, I checked an founded the auto ads code in my header is displaying this ads on this pages, so I go straight in excluding these pages from my Adsense account via going to the auto ads page, here is a guide on how to do that below.
How to Exclude Specific URLs on your site from displaying Auto ads
You can use page exclusions to stop Auto ads appearing on specific pages on your site. For example, you might not want to show ads on your homepage. When you add a page exclusion it overrides the Auto ads settings for your site.
Unsupported URLs
Make sure you enter a valid URL when you add a page exclusion. Auto ads doesn't support URLs that contain fragments (e.g., www.example.com/page#top) or parameters (e.g., www.example.com/page?q=target).
Add a page exclusion
- Sign in to your AdSense account.
- Click Ads and then Overview.
- In the table of all your sites, click Edit next to your site.
- In the "Page exclusions" section, click Manage.
- If you have existing page exclusions, click +Add exclusion.
- Enter the URL of the page or section you want to exclude.
- Choose either:
This page only - to exclude ads on the exact URL match only.
or
All pages under this section - to exclude ads on whole sections of your site that share the same URL prefix. For example, let's say you entered the URL example.com/sports. In this case, we would exclude Auto ads on example.com/sports, www.example.com/sports and example.com/sports/team but not on subdomain.example.com/sports.
- Click Add.
- Click Apply to site.
It can take up to an hour for the new settings to be applied to your selected URLs.
So the above method is only for auto ads, when I was done, I checked and the auto ads has left from the pages but the ads unit I manually installed on sidebar, header and footer ads widget was still showing.
I have no option than to go to my layout and remove these ads unit (disabling the ads widget) and the ads disappeared from the pages so now the pages are Ads free but one issue about this is that, the Header Ads and other widget also affects the rest of my pages since this widget is what I use in displaying ads in all my posts and pages.
I made thorough research to find a solution but no avail until I thought of using CSS to block the ads on static pages.
How to block AdSense Ads on Static Page
Fortunately, it's not difficult to block AdSense ads from static pages. Just add a CSS rule with a "static page" conditional, to block display of each AdSense gadget.
"<b:if cond='data:blog.pageType == "static_page"'>"
Blocking Ads via AdSense Widget on Blogger
If you want to block gadget "AdSense1" from displaying on all static pages, that's a simple CSS rule used to block stactic page items.
Note that I wrote this to selectively block AdSense gadgets from displaying - but you can use it with any gadget, that you need to block. "AdSense widget" is simply one gadget that needs to be selectively displayed.
"<b:if cond='data:blog.pageType == "static_page"'><style> #AdSense1 {display: none !important;} </style></b:if>"
As always, be aware that the blank line above and below the code, as displayed here, is not intended to be decorative. Any time you add CSS rules, the blank line is required, to separate each CSS rule - and make each rule operational.
If the blog publishes actual blog content on some static pages, conditionals will be a bit more complicated. This is one more reason why static pages are not typically used for blog content.
Owners of #Blogger blogs with AdSense ads, that use static pages without AdSense relevant content, need to block ads from displaying on such pages. Failure to display ads selectively can cause problems with ads on the blog.
If you observed very well you will notice I use #AdSense1, please check your source code of your page and locate the ID your Adsense is using. This applies to those who created ads unit using the default Adsense Ads gadget on blogger.
The first Ads you created goes with the ID AdSense1 and second AdSense2. Please ensure you note the Id you want to block, and replace it or include it in the blocking code I gave you, #AdSensen where "n" is your AdSense ID. In a scenario whereby you used more than one AdSense gadget, let's say AdSense1, AdSense2 and AdSense3, in the css style I gave to you, you are to include all the ID, see example below
"<b:if cond='data:blog.pageType == "static_page"'><style> #AdSense1, #AdSense2, #AdSense3 {display: none !important;}</style></b:if>"
In the above css style, you can see how I used all the Adsense widget ID to one particular rule in the bracket and then the IDs listed out separated with commas. If you can't locate or edit this files, please look for someone who knows how to use this codes to modify it.
Blocking manual Ads code you added via HTML/Javascript widget on Blogger
If you are familiar with CSS, you will know classes in DIVs or other items takes their command from when they are called using the dot sign (.) for example, your class you used to wrap your ads is ADSENSE. see below
<div class="ADSENSE">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4382543349088699"
crossorigin="anonymous"></script>
<!-- Footer -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-4382543349088699"
data-ad-slot="7712472860"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
You can see how I wrapped my AdSense Ads unit with DIV with class name ADSENSE in my HTML/Javascript widget on blogger. In my css files I will call the class with a dot (.) and not #, # is for IDs and dot (.) is for classes. Example below
"<b:if cond='data:blog.pageType == "static_page"'><style> .ADSENSE {display: none !important;}</style></b:if>"
In the above code, I have prevent all DIVs or elements with ADSENSE class from displaying on that static page like in the rule above.
The difference is that you don't have to create different class for each ads unit you used on the HTML/Javascript widget you used on your blog. One class can work for all the ads unit.
Note: You can hide any element as long as the class is with ADSENSE as used in the CSS in your head section of your site. You are not limited to hiding just AdSense ads unit, you can hide other items too.
If the ads is not hiding then there is a problem in the DIV. The ads unit refused to take the class declared, so you change your ads unit code this way instead of wrapping with a DIV.
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4382543349088699"
crossorigin="anonymous"></script>
<!-- Footer -->
<ins class="adsbygoogle ADSENSE"
style="display:block"
data-ad-client="ca-pub-4382543349088699"
data-ad-slot="7712472860"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
You can see where the class name is, and no longer wrap with DIV, you can add DIV but make sure you declare the class inside the AdSense script yourself. This must work.
Adding/Editing CSS to your Blogger Template?
You can add CSS anywhere between <b:skin> & </b:skin> but typically it is better to add it at the end, above </b:skin>. You can easily add CSS to the Blogger Template Designer (Template > Advanced > Add CSS), once you add the code hit enter and save.
"You are to add it without the <style> tags"
This will get added to the bottom of the CSS, just before </b:skin>. If you want to edit existing CSS, it is better to edit the original code rather than adding more. It just makes it neater and easier for browsers to read.
You can as well, add the style any where in your head section to make it function but with the <style> tags in the code like I did in the previous picture above this one.
Remove a page exclusion via auto Ads
- Sign in to your AdSense account.
- Click Ads and then Overview.
- In the table of all your sites, click Edit next to your site.
- In the "Page exclusions" section, click Manage.
- In the list of page exclusions, find the exclusion you want to remove.
- Click More and then Remove.
- Click Apply to site.
It can take up to an hour for the new settings to be applied to your selected URLs.
Conclusion:
You can use the code, to block display of any gadget - as long as you know the gadget name. I gave you "AdSense1" because AdSense gadgets are the most commonly in need of blocking, on static pages - but you can block any gadget necessary.
If you have an "HTML" gadget, you'll have "HTMLn". So find out the exact ID, and paste the ID into the CSS rule.
The css should be added in your css file or in the head section where your css is but remember give the space at the top and the bottom of the line you just added because the blank line is required, to separate each CSS rule - and make each rule operational.
If this solved a problem kindly comment with Thanks below and show appreciation by just sharing this post with friends online via the share buttons, thank you.