I have four AdSense widgets on my website. I added the script below to each of the widgets on my theme panel:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
     (adsbygoogle = window.adsbygoogle || []).push({
          google_ad_client: "my-pub-code",
          enable_page_level_ads: true

Is this effective? Placing the same code to four widgets wouldn't make it slow? Do you have any recommendation to optimize faster ads loading time or my approach is standard?

I was wondering if <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> could be inserted in one place only to load faster. Is this a good approach? Should I put it on index.php?

1 Answer 1


The AdSense snippet will not work if it is inserted into the page just once. You have to insert the snippet into each ad slot.

You could sign up for Google DFP. That is Google's ad server. It works more like you want. It has a JavaScript src in the top of the page and then each slot has some JavaScript statements that load the ads. DFP can be configured to show AdSense.

However, it doesn't really matter for speed. That particular script is very fast. Google has likely set it to be cached for a bit, so that multiple inclusions in the same page won't cause it to download multiple times. The slow part of ads is loading the actual ads themselves. They can really be bloated. If you have four ad slots, you will have visitors downloading four different ads. They may include large images, lots of scripts, or even videos.

Introducing lots of downloads and slowness is unfortunately part of showing ads and making revenue from them. The good news is that it happen asynchronously and doesn't usually interfere with actual page content loading.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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