Archived topic
Adsense Auto Ads push down page and leave white space
13 replies · Started by Gianluca on April 17, 2020
I have inserted the Adsense Auto Ads (https://support.google.com/adsense/answer/9261805?hl=en-GB#auto_ads) code in the header with the plugin Insert Headers and Footers, but I noticed an issue from mobile devices that push down all the page when a specific type of ad (Anchor: Ads that stick to the edge of the user's screen and are easily dismissible screenshot https://imgur.com/a/MdhFGEU) is dismissed (screenshot https://imgur.com/a/wSpXTzt).
I'm not logged into Wordpress and I'm visiting my page in incognito mode. Is happening from different browsers such as Chrome and Safari.
Do you have any idea why and how to fix this?
Thank you in advance
Hi there,
Have you checked with the plugin support to see if they've seen similar issues?
Generally speaking, manual ad with hooks elements is the method we usually recommend.
Hi Leo, could you please guide me to insert code between the <head></head> tags of my site with hooks?
Hook > wp_head
Execute Shortcodes?
Execute PHP?
Priority?
Location > Entire Site
Thank you
Can you copy and paste the code here?
Make sure to highlight the code and click the code button.
<script data-ad-client="ca-pub-XXXXXXXXXXXX" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
Is that the code for auto ads?
Can you try adding manual ads using hooks?
Yes, is the code for auto ads which is the one I'm having issues with.
I don't have any problem with manual ads, that's why I'd like to try the auto ads with hooks if you could guide me.
Thank you!
To add it using Hooks:
1. Appearance > Elements > New > Hook
2. Add yours script
3. Select the WP_Head hook
4. Set your Display Rules.
Thats it.
Hi David, thank you for your help.
I've removed the code from the plugin Insert Headers and Footers and added it with Hooks, but I have the same issue as mentioned in my first post.
Do you have any idea why it's happening? Could be some conflict between GeneratePress and that specific code?
Thank you in advance for your help!
Sorry are you still using auto ads?
I believe that's the issue.
If you try manual ads instead, then you can choose the desired hook to make show at the desired locations:
https://docs.generatepress.com/article/hooks-visual-guide/
Let me know if this helps :)
Hi Leo,
Manual Ads and Auto Ads are 2 different things.
Manual Ads are fixed size or responsive and you can put manually in different location of your articles and pages, while Auto Ads are placed by Google automatically in order to optimize earnings, that's why I'd like to try them but I believe there's an issue with your theme.
From the Google Adsense dashboard I can disable ads that I don't want, but I decided to ask in the support forum if you could figure out what is the problem caused by this specific ad called vignette https://imgur.com/a/MdhFGEU when is dismissed by users, as you can see from here https://imgur.com/a/wSpXTzt the page is pushed down and there's a white space which shouldn't be there.
I hope my question is clear, and I'd appreciate if you could look into this issue.
Thank you in advance.
Gianluca
The AutoAd script is adding inline CSS to the <body> element of your site.
This adds Top Padding to provide the space for the advert.
Unfortunately what it doesn't do is remove that styling when the advert is hidden or 'change' any element attributes we could use to overwrite the styles.
You may want to raise it with Adsense.
Ok David, thank you for your help.
No problems - sorry we couldn't be of any more help