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/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=" 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=".js"></script>
<script async defer src=" 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
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./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./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./bidder/adsboosternopb.js"></script>
<script async defer src="https://cdn.exmarketplace./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
2 Answers
Reset to default 3No, You must consider a way to lazy load adsense ads. While considering lazyload, i have figured out that adsense does not push ad-slots to specific containers in order. Deferring script load will introduce a further delay and bottleneck adrequests ultimately resulting in lower adviewablity and earnings. By the time the adload, user would have scrolled further away from the ad.
Updated
Here is a way to Lazy Load Ads
After years the load javascript on mouse scroll or touch (if a touchscreen device) has bee a thing.
On WordPress there's a very cool plugin that does that https://wordpress/plugins/flying-scripts/ as well as WPRocket has introduced functionality to delay javascript execution (including Google Adsense JS)