Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Tell HN: Adsense started altering the pages it is on
12 points by FreeHugs on Sept 3, 2019 | hide | past | favorite | 4 comments
Some days ago, my pages where I have Google Adsense on were suddenly completely broken.

After some investigation, it turned out that the Google Adsense code started to change the styles of the page it is on.

It seems it figures out which parent element or grand-parent or grand-grand-parent... element is limiting its height. And then adds "height: auto !important" to that element.

If it is limited by max-height, it adds "max-height: auto !important" to the limiting element.

I had Googles dynamic ad sizes in a div with a size that fits my layout. Since they adapt to the space they get, everything was fine. But now they explode their parent element to a size that breaks my site.

I find this behavior pretty shocking.



Are you by any chance placing these ads in-feed? They do call this out. It's definitely odd that they're doing this.

https://support.google.com/adsense/answer/9189959?hl=en


I am not using the in-feed ads, but the responsive ads.

No matter which ads - I think it is not acceptable that they alter the surrounding page. They also don't state that on the page you linked. What they talk about there is about the size of the ad. But what the ad code does now is to analyze the rest of the page and alter it.


Can you put the ad into a iframe?


Nope. Adsense scripts enforce height=auto!important on the parent elements of wherever it is placed, and often render an iframe with dimensions exceeding the widths of the container. Their responsive ads are also huuuge now, like 970x600




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: