The official help does not mention such modification, but people mention this solution at various places on the net, saying they do this for quicker page load.

How can one be sure that it's an allowed modification of the default ad code (which otherwise loads during page load, before the window.load event), so one's account won't get suspended or banned for it?

  • Have you read Google's AdSense code manipulation policies? support.google.com/adsense/answer/1354736?hl=en They seem fairly reasonable – Stephen Ostermiller Jun 16 '16 at 20:12
  • 1
    @Stephen Ostermiller yet, it's not in the acceptable modifications, so it's a gray area. "harms advertiser conversions" is a blanket term which can be applied to a lot of things, including delaying loading the ads compared to the default code – Tom Jun 16 '16 at 20:17
  • Delaying load might hurt CTR, but it shouldn't hurt conversions. – Stephen Ostermiller Jun 16 '16 at 20:20

According to this Google Policy:

Publishers are permitted to make modifications to the AdSense ad code so long as those modifications do not artificially inflate ad performance or harm advertisers.

Loading Ad. script on Window load event in no way breaches this agreement. So by this one sentence alone, you can be sure that it is allowed.

Also, according to this Modification of the AdSense ad code document:

In general, we recommend copying and pasting the ad code. In some situations though, we understand that modifications are crucial to a clean user experience.

So here as well you can see the same confirmation. Basically as long as you don't fundamentally change how the ads are being displayed, you are fine.

Furthermore, in the Techniques to avoid section, you'll see none of the points conflicts with window load event. On the other hand, the Acceptable modifications section clearly states:

Here are some acceptable modifications ...

That means, not all the acceptable modifications are listed there. So, as long as you simply load the CODE in window load event & do no further artificial delay, Google have no reason to penalize you, since window load event is one of the most common Browser Default method people use to load additional scripts and contents. At best they may say that it's not necessary anymore & their asynchronous CODE is optimized enough.

Finally: I've done this myself on my own site and other client sites & never faced any problem whatsoever. Also didn't ever heard or seen anyone having any issue for this. Even a quick search on Google didn't reveal anything like that. So you should be fine.

| improve this answer | |

This is not necessary. The latest ad code uses the "async" attribute on the script tag, which means it does not block rendering or delay loading of your site.

The tag that loads the script looks like this:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

If you are loading multiple ads per page you should include that line once only (not once per ad).

| improve this answer | |
  • 2
    This is not the issue. adsbygoogle.js itself can be loaded async and most likely it is already cached because of other pages. The heavy loading part is the indvidual ads which slow down page load, especially if the page loads additional stuff, e.g. google maps widget, etc. My question is about prioritizing important stuff which is necessary for the page display (map widget, etc.) and load the actual ads in the window.load event when other external scripts necessary for page display have been loaded already. That is the question if policy allows loading the ads in the window.load handler. – Tom Jun 17 '16 at 15:05
  • I mean the (adsbygoogle = window.adsbygoogle || []).push({}); part which does the actual loading of ads after adsbygoogle.js has been loaded. – Tom Jun 17 '16 at 15:07
  • 1
    All that code does is add an empty element to an array, so it must be something in the external file that actually does the loading. Did you try putting the (adsbygoogle=...) code into window.onload, e.g. on a test page? I'm not sure it would actually work. – DisgruntledGoat Jun 17 '16 at 16:01
  • "All that code does is add an empty element to an array" Only if adsbygoogle is not yet loaded. But if it is loaded then it overloads the push function to perform the actual ad loading – Tom Jun 17 '16 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.