AdSense Asynchronous Code: How to Use It for Faster Site Speed (2026)

Is the AdSense asynchronous code slowing your site, or are you still running the old synchronous show_ads.js snippet? In 2013 we recommended switching every ad unit to Google’s new async code, so ads load in the background without blocking your page. Today async is the only code AdSense gives out, but many sites still paste it wrongly: loading the script several times, adding it to slow plugins or blocking it with layout shift. Here is how the asynchronous AdSense code works in 2026 and how to use it for the fastest pages.

AdSense asynchronous ad code

Quick answer: Use the current AdSense code, which loads adsbygoogle.js with the async attribute. Put that script once in the page head, then place each ad unit’s <ins class="adsbygoogle"> tag and push line where you want the ad. Reserve space for ads with CSS to avoid layout shift, and remove any old show_ads.js code.

Why asynchronous ad code is faster

A normal script stops the browser from building the page until the script downloads and runs. An async script downloads in parallel and runs when ready, so your text and images appear first. That helps your Core Web Vitals and keeps readers from leaving before the page appears. Check the result with our list of web page speed tests.

Old synchronous AdSense code (do not use)

<script type="text/javascript">
google_ad_client = "ca-pub-1234567890";
google_ad_slot = "12345";
google_ad_width = 336;
google_ad_height = 280;
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

This code blocked the page and used plain HTTP. Replace it everywhere.

Current asynchronous AdSense code

<!-- once, in the head -->
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890" crossorigin="anonymous"></script>

<!-- for each ad unit -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-1234567890" data-ad-slot="12345" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>

Copy the real code from Google AdSense (external site) under Ads, then By ad unit, and use your own publisher ID and slot.

Best practices for async AdSense code

  1. Load adsbygoogle.js once per page. AdSense code for each unit repeats the script line; keep one copy in the head. See how to load the AdSense script once.
  2. Do not modify the code beyond what AdSense allows, as changing it breaks the policies. Avoid these common AdSense mistakes.
  3. Reserve space. Give ad containers a minimum height with CSS so content does not jump when the ad loads.
  4. Use Auto ads if you prefer. The same head script powers AdSense Auto ads.
  5. Keep other scripts async or deferred, and load non-essential scripts like Bootstrap at the end of the page.
  6. Do not lazy load ads with your own tricks. AdSense already optimises loading, and custom delays can break viewability.

Async AdSense code in WordPress

Add the head script with Site Kit by Google, an ad plugin, or your theme’s header script box, then insert ad units with an ad inserter plugin. Our guide to the best WordPress plugins for AdSense covers the options. After any change, clear your cache and test a page in PageSpeed Insights.

How to check your ads load asynchronously

Open a page with ads, press F12 and look at the Network tab while reloading. The adsbygoogle.js request should appear once, and your page text should render before the ad frames fill in. In PageSpeed Insights, “Reduce the impact of third-party code” will list Google ads, but render-blocking resources should not include them. If you still see show_ads.js anywhere, search your theme files, widgets and ad plugins for the old code and replace it. Finally, check a few pages on a phone over mobile data, where slow scripts hurt the most.

FAQ

Is AdSense code asynchronous by default now?

Yes. All AdSense ad code uses the async adsbygoogle.js script. Only very old sites still have show_ads.js code.

Where should I put the AdSense script?

Google recommends placing it in the head section once. The ad unit tags go where you want ads to appear.

Does AdSense slow down my site?

Ads add some load, but async code keeps your content loading first. Fewer, well-placed ads are faster and often earn more.

Stuck on a gift? Try our free Gift Idea GeneratorIdeas for anyone by age, job, interests and budget, with Amazon.com and Amazon.in linksFind gifts →

Found this useful? Share it with someone who needs it.

Get our free weekly email: new tech guides and tools, no spam.

New and updated tech guides, a free tool worth bookmarking and one useful pick, once a week. No spam, unsubscribe anytime.

One email a week. Unsubscribe anytime. See our privacy policy.

Related Tech Guides

Leave a Reply

Your email address will not be published. Required fields are marked *

30 Comments

  1. Thanks for posting, I really enjoyed reading and certainly will be taking your advice and learning from your tips

  2. I’m planning to place Adsense in my site without interfering site’s performance. And this tip is of help. Thanks for sharing!

  3. I can find money online by Adsense but google always block my Adsense many times. thank you for sharing this information :)

  4. Thank you share best tip. I always with slow loading of my site when I use more adsense banner in the same page.

    Thank you

  5. Yes i agree with you after using Adsense Asynchronous Code make the performance of my site faster than before. I have tested it last month. Anyway, thanks this great tips.

  6. I’ve never think about this point. Adsense also relevant to our site speed. Thanks for this great info while I’m trying to find more on how to increase my site speed now. John.

  7. I’ve never think about this point. Adsense also relevant to our site speed. Thanks for this great info while I’m trying to find more on how to increase my site speed now.

  8. Wow, Loading website fast is what the web master and visitors really need. without adsense i can’t create blogs and update it often. Thanks for the tips.

  9. If you’re already using jQuery on your page, you can use jQuery to shorten the amount of JavaScript necessary for both the standard and font event asynchronous patterns discussed above. This reduces the size of your HTML page, but also delays the loading of the Typekit script until the jQuery script can be downloaded, parsed, and executed. You can see the standard jQuery pattern and font events jQuery pattern on GitHub.

  10. When you dynamically append a script to a page, the browser does not halt other processes, so it continues rendering page elements and downloading resources. The best place to put this code is right after the opening body tag. This allows Facebook initialization to happen in parallel with the initialization on the rest of the page.

  11. I’m pretty sure this still qualifies as asynchronous because the resource they are loading is a script-injected script, meaning it won’t parser block.

  12. The simplest solution is to keep all of your scripts inline at the bottom of the page, that way they don’t block the loading of HTML content while they execute. It also avoids the issue of having to asynchronously load each required script.

  13. put a huge smile on my face. Blocking is a huge bottleneck for every website and the ability to easily direct a script to load asynchronously should speed up the web!

  14. Thanks for information on Google Adsense Asynchronous and Synchronous as I was not knowing this information

  15. As said above, the page will load faster, but we might end up dealing with some minor effects. For example, the asynchronous loading of the external resource could move page elements after the page is loaded, causing an unwanted “resetting” of some elements (like the sliding of a container). In other cases, some functions might be available to the user with a small delay, giving the impression that the page froze for a moment. Those counter-effects can be solved by carefully placing the loaded content (‘http://externalDomain.com/script.js’) in the right spot or, for example, creating the needed space when the page loads. In the end, we have to play with it a bit to fully understand how to correctly implement the asynchronous loading of JavaScript snippets. As usual, we need to test and trial, but I’m sure you will find the idea quite interesting in many cases.

  16. Were just starting to use adsense in a few of our clients sites so will give it ago,thanks for sharing

  17. Opera needs to enable async support by default. Firefox supports the async attribute, and all other browsers (except Opera) will load scripts asynchronously if they are injected as a script DOM element. Opera is the only browser that doesn’t support async scripts out of the box.

  18. Actually, I don’t know before about Asynchronous Adsense Code. So first I would like to giving thank you for this great information. I will try it in my website to make my site faster. Hope it will work faster.

  19. Good to know about the asynchronous code. I will try that asap.
    Thanks, for the share.

  20. Switched to asynchronous code two days ago and I can see a slight increase in CTR even though traffic didn’t fluctuate much.

  21. oh! I just hear about “Asynchronous” adsense code today! Will try on some of my fast loading site to test and see!! Thank for the tips!

  22. We create a new script tag, set a type and an source, specifies that it should be loaded asynchronously then add it to the head tag of our page.

  23. I think its important that google is recognizing where they could be at fault with load times, they are definitely one step ahead of the curve as I am sure much of the code used on advertisements will be slow to make the same changes.

    1. been seeing such a code all the time when logging into adsense but dont know it’s functionality. Great to cross your post