wp-rocket icon indicating copy to clipboard operation
wp-rocket copied to clipboard

Delay JS - Google Ads not showing

Open webtrainingwheels opened this issue 6 years ago • 11 comments

We have a couple of cases where Google Ads are not showing when the default list of delayed scripts is used. Removing adsbygoogle resolves it.

Ticket: https://secure.helpscout.net/conversation/1278600269/193807?folderId=377611#thread-3670406924 I did not see a console error in this case. The delayed scripts are not getting replaced with the real ones on interaction. This is how it looks in the Inspector: https://jmp.sh/AWEwBri

Possible case: https://secure.helpscout.net/conversation/1278337450/193706/

Backlog Grooming (for WP Media dev team use only)

  • [ ] Reproduce the problem
  • [ ] Identify the root cause
  • [ ] Scope a solution
  • [ ] Estimate the effort

webtrainingwheels avatar Sep 11 '20 00:09 webtrainingwheels

Not sure if it's related, customer reported that revenue went down, but everything seems okay now - https://secure.helpscout.net/conversation/1275071766/192634/

arunbasillal avatar Sep 11 '20 06:09 arunbasillal

According to this discussion in Slack, @engahmeds3ed mentioned that the Google Ads script is using DOMContentLoaded.

The way our feature is implemented, the execution of such scripts should not be delayed.

vmanthos avatar Sep 14 '20 04:09 vmanthos

This issue can be related to the fact our inline scripts to preload / delay JS files were included into the concatenated file. On the two cases we had, one of them has been confirmed related to this problem. The concatenated file had a JS error which stop our features to work properly.

If the issue was really related to the DOMContentLoaded, I suppose we should have more tickets about Google Ads.

A PR is done to auto-exclude our inline scripts: https://github.com/wp-media/wp-rocket/pull/3095

GeekPress avatar Sep 14 '20 16:09 GeekPress

https://secure.helpscout.net/conversation/1282673567/194973?folderId=377611

webtrainingwheels avatar Sep 15 '20 23:09 webtrainingwheels

I can confirm that I am also facing such a revenue drop and the ads are not visible all the time. Sometimes it works sometimes doesn't. A strange behavior. Also, on some websites, the ads are only visible when the mouse is hovering the "Content" div. For example, if there is blank space on the outer div, the ads are not loading until the mouse is inside the div making the ads appear late considerably affecting the viewability of ads.

MuhammedSwalihct avatar Sep 16 '20 11:09 MuhammedSwalihct

I want to add, that I faced this issue until I changed the rule of adsbygoogle to adsbygoogle.js so only the main JS file is deferred, and the inline script remains unchanged.

ScottTravisHartley avatar Sep 17 '20 00:09 ScottTravisHartley

~Possible case: https://secure.helpscout.net/conversation/1284650572/195485/~ Ads are showing. Side note: Customer reported they had a fraudulent clicks campaign going on, and delaying Adsense actually helped skip clicks from bots :)

DahmaniAdame avatar Sep 19 '20 04:09 DahmaniAdame

related: https://secure.helpscout.net/conversation/1301839373/200133/ replacing adsbygoogle to adsbygoogle.js solves the issue

NataliaDrause avatar Oct 07 '20 14:10 NataliaDrause

related: https://secure.helpscout.net/conversation/1298929177/199275?folderId=3864740 only ads added by Advanced Ads Pro plugin had this issue. replacing adsbygoogle to adsbygoogle.js solves the issue.

NataliaDrause avatar Oct 10 '20 07:10 NataliaDrause

We don't have many more reports about this and with the change in default from adsbygoogle to adsbygoogle.js as per https://github.com/wp-media/wp-rocket/issues/3119 it should cover cases reported here.

Going to close this for now. Please feel free to reopen if that is not the case.

arunbasillal avatar Oct 22 '20 19:10 arunbasillal

Looks this problem is still existing. Ads are not appearing in WP Advanced Ads when I enable wp-rocket-delay in javascript execution. Any solution for this?

hisureshkumar avatar Apr 04 '21 16:04 hisureshkumar