Question

Google Ads slow my site loading

  • Posted January 31, 2020
  • API

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.

Subscribe
Share

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

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.

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