WordPress Speedup – Change the way you add Google Adsense Ads

wordpress blue and white and grey logo

Last updated on April 1st, 2023 at 06:38 pm

Read Time:1 Minute, 35 Second

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.

Avatar for Andrew Armstrong

About Post Author

Andrew Armstrong

Founder of TechyGeeksHome and Head Editor for over 15 years! IT expert in multiple areas for over 23 years. Sharing experience and knowledge whenever possible! Making IT Happen.
Click to rate this post!
[Total: 0 Average: 0]

Free Subscription

If you want to be notified when we post more quality guides like this one, sign up to our free subscription service and you will receive an email when a new post is live.

Join 555 other subscribers.

No need to worry, we will not be filling your inbox with spam and you can unsubscribe anytime you like.

Leave us a message...

This site uses Akismet to reduce spam. Learn how your comment data is processed.