Switch Google Adsense to Asynchronous Ad Code for Speed Boost
Today’s post is a quickie and a must read if you’re using Google Adsense.
This won’t make your site load faster. It potentially helps it appear faster since your browser isn’t waiting for the Adsense code to execute before it processes the remainder of the page.
How to Find the Asynchronous Ad Code
If you’re familiar with Adsense, just go to the ad unit area of Adsense, get the code, and click on the drop down to show the Asynch code. If you’re not as familiar, the longer more detailed version is…
Log into your Google Adsense account and click on My ads in the header. It should load up your list of Ad units, click on Get Code underneath the name and you should see this pop up:
Click on the drop down to load the Asynchronous (BETA) code:
Copy and paste that in the place of your ad block.
Small Tweak for Multiple Ad Blocks
If you have multiple ad blocks, you can load the two parts of the code separately. The first section:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
Put that snippet at the top of your theme before your </head> tag.
Then the rest can be placed where you want the ad to appear. Just remember to remove that first line with each ad block since you’ve already loaded it in the header. Keeping them there won’t do any harm, the browser will just load it again (technically, it might not because of caching but it’ll execute it multiple times).
That’s it! Told you it was quick.
Latest posts by Jim (see all)
- How to Auto-Tweet Posts from an RSS Feed and Tag Someone - December 20, 2016
- How to Delete a Website from Google Analytics - December 9, 2015
- Don’t Use Public URL Shortening Links in Emails - June 12, 2015