I'm running a wordpress blog that includes advertisement from adsense and Google ADX.
The website loads in less than 1 second when the advertise is disabled and in more than 3-4 seconds with the advertise actived.
I know the performances of the website with advertise on are always worst than a website withouth advertise but, in my case, the problem is the wrong time in loading the advertise.
I currently load my advertise in the footer like this
<script async defer src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "my ad client",
enable_page_level_ads: true
});
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async defer src="https://www.googletagmanager.com/gtag/js?id=my id"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'my id');
</script>
<script async defer src="https://cdn.exmarketplace.com/bidder/adsboosternopb.js"></script>
<script async defer src="https://cdn.exmarketplace.com/bidder/my web/my web.dfp.js"></script>
And the ad units like this
<!-- Adaptive Header -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="my ad client"
data-ad-slot="my ad slot"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
Now, the problem isn't really the adsbygoogle javascript, which loads as fast as my content; the problem is all the ads content loaded by the script from external sources that, loads randomily during the paint or the load of the important content of my blog (such as the article's text and images).
I've read this article Load Google Ads after entire page has loaded about the window.onload = function()
and I was wondering if, after 5 years from that answer is it a way I can use to speed up the advertise