Google Adsense is a product of Google. For the purpose of loading Adsense ads after the page is fully loaded, you can use the following script to load it.
The ads of Google Adsense are slow your website speed. If your website takes a lot of time, then it's a problem with AdSense js code. You have to do some customization with javascript. You need to get Javascript help to perform custom functions.
You have created a website on any platform; the Solution of this javascript will help you for all platforms.
After inserting the code from Google Adsense, if your website is taking a very long time to load the entire page then you have to optimize it via the js function.
Let's talk about how to optimize Google ads.
Step1
first of you have to add this code in <body> tag .
<body onLoad="page_begin();">
Step2
Now remove the below adsense code from all ads . (This code is place only in the head=>Under the head section )
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js">
</script>
Step3
Also, remove below Adsense code from all ads. (This will define in a javascript function)
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
Step4
Paste this code under the head tag. (before closing the head tag)
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js">
</script>
Step5
To inialise the whole page you have to create a function initialize_page() .
function page_begin()
{
(adsbygoogle = window.adsbygoogle || []).push({});//this is for the first adsense
(adsbygoogle = window.adsbygoogle || []).push({});//this is for the second
(adsbygoogle = window.adsbygoogle || []).push({});//this is for the third
}
Step6
If you want five or more Adsense codes on one page then you have to increase code this way.
function page_begin()
{
(adsbygoogle = window.adsbygoogle || []).push({});//this is for the first adsense
(adsbygoogle = window.adsbygoogle || []).push({});//this is for the second
(adsbygoogle = window.adsbygoogle || []).push({});//this is for the third
(adsbygoogle = window.adsbygoogle || []).push({});//this is for the fourth
(adsbygoogle = window.adsbygoogle || []).push({});//this is for the fifth
}
Now when your page is fully loaded then all google adsense ads will load .
Note: - This is a tested method. Read the complete solution and then apply. It will help you.