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

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

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

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel