Forum Moderators: martinibuster

Message Too Old, No Replies

ads in hidden DIVs for responsive layout?

         

westcoast

3:18 pm on Oct 11, 2017 (gmt 0)

5+ Year Member Top Contributors Of The Month



I have a responsive layout where one column is visible only on desktop. There is a skyscraper ad in that div.
On a mobile that column and ad are not visible.

1. Is this legal by Adsense's terms and conditions?

2. Could this harm me by inflating ad-loads when it is not viewable? Dont some browsers still load images, etc in hidden divs? Could these background loads hurt the performance stats and therefore my payouts?

3. If the answer to either question indicates that what I'm doing is wrong, can anyone suggest how to best hide an ad for certain devices in a responsive layout?

Thanks!

keyplyr

6:04 pm on Oct 11, 2017 (gmt 0)

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



1. Yes

2. The code will be parsed but not displayed by the browser. Very little hit on load time.

3. Unless you are doing this in an uncommon way, you should be fine.

Most all responsive layouts use CSS to show some ads and not others depending on device screen size.

levo

6:27 pm on Oct 11, 2017 (gmt 0)

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



You can inspect the hidden element to be sure. Google leaves following comment inside it.

<!--No ad requested because of display:none on the adsbygoogle tag-->

jbnz

6:50 pm on Oct 11, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hi Westcoast,
I use the recommended code from Google to do exactly what you are looking for. Here's their Help page on the topic
[support.google.com...]

NickMNS

7:49 pm on Oct 11, 2017 (gmt 0)

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



@westcoast
1. Absolutely not. You must be sure that if you do not wish not to display an ad-unit that its tag is set to display:none such that the ad is not called on page load. Otherwise the ad will be displayed but be hidden from users, and this is a policy violation. If it isn't flagged as a violation, then it will destroy your AVV as the hidden ads will drag the metric down and this can impact earnings. Be sure that if an ad is hidden the js is not executed.
2. See answer one.
3. Follow the instructions in the link submitted by @jbnz

keyplyr

8:33 pm on Oct 11, 2017 (gmt 0)

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



1. Absolutely not. You must be sure that if you do not wish not to display an ad-unit that its tag is set to display:none such that the ad is not called on page load.
That's what he said, unless I'm not understanding his intent.

CommandDork

2:58 am on Oct 12, 2017 (gmt 0)

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



Ya. I thought there was a specific way they wanted you to go about it:

Techniques to avoid
Here are some techniques you’ll want to avoid:

Hiding ad units at anytime (e.g., display:none), unless you're implementing a responsive ad unit.

[support.google.com...]

Bluejeans

11:37 am on Oct 12, 2017 (gmt 0)

10+ Year Member



I've been using @westcoast solution for about two years without repercussions but I'll try the "right" approach and see if my AVV increases.