Forum Moderators: martinibuster

Message Too Old, No Replies

Set max height of responsive ad

Adsense overflowing container

         

surfgatinho

9:24 am on Apr 24, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Despite having run Adsense for nearly 15 yrs I feel like a noob having to ask a question as seemingly simple as this.

Previously I've run an ad above the fold, between the top nav bar and the page title. I had the container set to a fixed height of 120px and as far as I remember this worked. However, when I checked the site recently the responsive ad is spilling out of the container and over the content below.

So far I have set the container height in the CSS, set a max-height for the ad itself (.mob-top: max-height: 120px; <ins class="adsbygoogle mob-top"...) and have tried setting data-ad-format="rectangle".

None of this works. I don't get it - if it's all about UI surely Adsense should be encouraging smaller ads above the fold?! Also, I'm sure the ad doing this is breaking Adsense's own TOS.

On the plus side it doesn't seem to have affected revenue.

Any ideas? Thanks

CommandDork

11:36 am on Apr 24, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Does data-ad-format="horizontal" do anything?

surfgatinho

11:48 am on Apr 24, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Does data-ad-format="horizontal" do anything?


Doesn't seem to.

Can I just confirm that Adsense still provide responsive ads for mobiles of less than 250px in height. And I don't mean the tiny unreadable 320x50 old mobile type ads.

surfgatinho

12:01 pm on Apr 24, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just to add - Adsense is also showing image ads in this slot when I have specified text only over 12 hours ago...

NickMNS

12:38 pm on Apr 24, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Can I just confirm that Adsense still provide responsive ads for mobiles of less than 250px in height.

Yes, the only issue is that there maybe a lack of demand for these ad units thus coverage and revenue may be lower than normal.

Adsense is also showing image ads in this slot when I have specified text only over 12 hours ago...

There is a post in the April Adsense thread (bottom of page4, by Selen) that suggests that Google is deprecating the Text-only option. I haven't received an email to confirm this, so it may be rolling out account by account.
Link to April thread: [webmasterworld.com...]

NickMNS

12:39 pm on Apr 24, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



To answer the question asked in the OP:
[support.google.com...]

levo

12:57 pm on Apr 24, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Triple check your ad code in your source code from browser. All signs point to either broken ad code or auto-experiment by Google.

stateofmind

5:10 am on Apr 26, 2019 (gmt 0)

10+ Year Member



@surfgatinho I have experienced exactly the same as you lately, and I am a 10+ year AdSense publisher.

Here is what's happening:

Google has changed their JavaScript code to alter the containing element by inserting inline styles marked "!important;" on it. What they do is at least the following (perhaps more):

1) Setting height to Auto and min-height to 0
2) Setting margins and padding to 0

You can see this if you open up Developer Tools in Chrome and inspect your elements containing the ads.

This made my ads appear with no spacing between them and my text and images. I am very surprised that Google is doing this, as it kind of makes our sites violate their own terms by generating more accidental clicks. In addition to making the sites look very unprofessional/poorly designed, of course.

I did however find a workaround.

Previously my HTML was something like this:

<div style="min-height: 150px">
[Adsense Ad]
</div>

or


<div style="margin: 30px 0">
[Adsense Ad]
</div>

I have now changed it into the following:

<div>
<div style="height:30px"></div>
[Adsense Ad]
<div style="height:30px"></div>
</div>

This is working well. I now have got back my desired spacing before and after the ads.

surfgatinho

1:12 pm on Apr 27, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



@stateofmind will have a look at this. Would explain what I'm seeing as I have pretty much checked everything else, right down to validating my html.

I guess it might be Adsense trying to tell me something, i.e. bigger ads pay more, but I'm loathed to completely ruin the appearance of my sites.
I will try to implement a fix, otherwise I may move the ad to sit below the first paragraph / photo but above the fold and see how that affects revenue...