WordPress Speedup – Change the way you add Google Adsense Ads

wordpress blue and white and grey logo

Google Adsense is a great way of earning some cash by placing a few adverts on your WordPress blog. However, if you create an advert in your Google Adsense console and just copy and paste it straight into your WordPress site, you are loading a separate script each time for each advert. So, would it not be better to just load the script once and then have all your adverts be served by the one loaded script?

Well, you can do it and it is very simple to do by following the few basic steps below.

First of all, you need to identity the script that will need to be loaded just the once. You will find this at the top of your ad code. If you are using asynchronous ads then the script will look something like this:

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

Take this script and then go into your WordPress Administrator Console. Then browse your way to Themes -> Editor. You then need to edit your Theme Header (header.php) file. Once you are in the editor, paste the script in between the <head> and </head> part. This will then load this part of the script from the header on page load.

All you need to do then is to delete this same code from each advert that you have on your website.

Save everything and then give it some time for your caches to catch up (if you are using them – which you should be!) and you will find that your website is making much less requests and in turn will load quicker speeding your website up!


We would love to hear your feedback on this guide and whether it has helped you or if you have any further suggestions or questions – just leave us a comment below.

Free Subscription!Subscribe to our site to receive updates via email!

Enter your email address below and click the Subscribe button to receive email notifications about new and exciting downloads available through our website at https://www.techygeekshome.com

You will also receive notifications about new technical guides, latest news and MSI installer downloads that are available through our blog here at https://blog.techygeekshome.info 

We will not spam you and we will not pass on any of your details to anyone else. We tend to post new content once or twice a week.

Join 279 other subscribers

You can unsubscribe any time you like.

About A.J. Armstrong

Founder of TechyGeeksHome and Head Editor for over eight years! IT expert in multiple areas for over 20 years. Sharing experience and knowledge whenever possible! Making IT Happen.

View all posts by A.J. Armstrong