Hi,
The other day I was answering @gatormark that, my "blank" ad spaces were correctly being collapsed by Adsense.
I thought it might deserve a discussion on its own, especially since, in a near future (or may be even right now), this is what Adsense is going to do for all slots: [
webmasterworld.com...] (among other things).
So, from "my" observations on "my" site (may be it's different elsewhere) :
- Ad slots above the fold, are never collapsed
If this is the expected behavior, I guess that this is to prevent "jumps" of the page layout, I don't know which word you are using in English. I mean, when elements of a page, keeps moving up and down as other elements are getting their final size. (good practice is to set the size of elements or/and placeholders)
Before being collapsed, ad slots are getting their desired size, then the height is turned into 0px if empty.
So, if even a tiny bit of an ad slot is visible above the fold, it won't be collapsed.
- If you control the size of the ad slot using CSS, then the ad slot will not be collapsed.
- Finally, if you want to detect, in javascript, if a slot is collapsed, you can check its height, using a timer function for example, but, the best remains to use the the ResizeObserver interface: [
developer.mozilla.org...] . However, it's actually supported only by Chrome and Opera, (and the next update of Firefox)