Question

Google Ads slow my site loading

MY site hosted on Digitalocean, without ads it’s loads in just seconds as google speed test.

FCP 2.4 FID 190 ms Rating 73 But with ads, it’s too much slow rating only 48

I am using a wp-rocket cache plugin, maybe there is a reason.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
February 2, 2020
Accepted Answer

Hello,

I’ve been noticing a similar problem with a few of my websites as well.

Having this in mind you could try to set a delay for the Google Ads script so that it loads your ads let’s say 5 or 10 seconds after your website content has loaded. That way it would not slow down the initial loading time, and the ads would show up a few seconds later.

You could do that by following the steps here:

https://wpfixit.com/super-slow-google-ad-script/

Basically what you need to do is to change the standard Google Ads script:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-UNIQUE_ACCOUNT#"
data-ad-slot="UNIQUE_AD#"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

To the following:

<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-UNIQUE_ACCOUNT#" 
data-ad-slot="UNIQUE_AD#"></ins>

<script type='text/javascript'>
(function() {
var done = false;
var script = document.createElement('script');
script.async = true;
script.type = 'text/javascript';
script.src = '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';

var createScript = setTimeout(
function(){
document.getElementsByTagName('HEAD').item(0).appendChild(script);
}, 5000
);

script.onreadystatechange = script.onload = function(e) {
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
(adsbygoogle = window.adsbygoogle || []).push({});
}
};
})();
</script>

Regards, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.