Notifikasi
You Don't Have Notifications.
last 7 days search..

How to Install Lazy Load Adsense

How to install lazy load adsense?

Ads Lazy Loading


Table of Contents

AdSense is an advertising collaboration program via the internet launched by Google. Through the Google Adsense program, members who have been approved for membership may place fish units on a personal website or blog.

The system is profit sharing with pay per click (ppc) income or pay per click. For those who have passed to become a member of Google Adsense, surely the web will be a little slow. This is because the default script is quite heavy.

The optimization method is to use the lazy load Adsense technique . Relax, here the admin will share how to install the new Google Adsense lazy load script code.




What is Lazy Load Google Adsense?

Lazy load adsense is a smart loading script that temporarily delays the loading of third party code. This method displays necessary ads when the user starts scrolling through the web page. Thus, it can reduce latency, CPU consumption, and maintain website performance.


Is Lazy Load Safe for Blogs?

Many questions arise about security if you have lazy load installed . The answer is safe, Google is also open in implementing this technique. The admin has also installed it since the beginning it was accepted by Adsense and there were no problems at all.




How to Install Google Adsense Lazy Load to Speed ​​Up Blog Loading

As time goes by, at this time there are a lot of scripts that are useful for our blog if we install them. One of them is the lazy load google adsense script . 

The working principle of the google adsense lazy load script is to optimize the google adsense java script script, so that loading is fast and does not burden the blog. Then how do you install lazy load google adsense? It's quite easy to install. Straight to,

1. open your blog dashboard .
2. Enter the theme , then click Edit HTML .
3. Search for the code <script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>, then remove the code from the template. If more than 1 is found, then delete all of them. Usually the amount of code is the same as the number of ads that you post.
4. After that look for the code </body>or &lt;!--</body>--&gt;&lt;/body&gt; then put the following code right above it.


<script type='text/javascript'>

//<![CDATA[

// Lazy Load AdSense

var lazyadsense=!1;window.addEventListener("scroll",function(){(0!=document.documentElement.scrollTop&&!1===lazyadsense||0!=document.body.scrollTop&&!1===lazyadsense)&&(!function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}(),lazyadsense=!0)},!0);

//]]>

</script>

5. Save it!





Lazy Load Ad Script In Various Versions

Then choose one of the following AdSense ad lazy loading methods, depending on your needs: Remember: pick only one! Don't forget to paste the base script in the marked place.

Oh yeah, you can also combine it with the blog images lazy load script and the YouTube video lazy load script to make your blog pages load even faster.

Installing this lazy-loading ad script will also improve your performance score when checked by web blog loading speed checking tools such as PageSpeed ​​Insight and GTmetrix. 

Manual Script Writing (Basic Script)

This section only applies if you create ad units and place ads manually. If you're running automated ads (Auto), you can skip this section.

For this lazy-loading script to work perfectly, you need to be careful about how you write proper AdSense ad code.

When you get the code from your AdSense dashboard, you'll usually be asked to copy a few lines of code. Never write an external script as it is already called from the above code. Just copy from the <ins> tag.

Just copy the one below, not in the red box


 
Do not copy the Adsense script code in the red box as above!

Lazy Load Adsense With Scroll

Lazy-loading on-scroll ad scripts are the most popular and widely used type. Ads load as users scroll through blog pages. 


<script> //<![CDATA[

  /* Lazy Load Ads on Scroll by igniel.com */

  let lzAd = false;

  window.addEventListener('scroll', () => {

    (0 != document.documentElement.scrollTop && false === lzAd || 0 != document.body.scrollTop && !1 === lzAd) && (!function(){

      Insert Your Basic Script Here

    }(), lzAd = true);

  }, true);

//]]> </script>

Lazy Load Adsense With Timer

This type of lazy loading ad script is triggered based on the countdown time. You can name it timer, countdown, whatever you like. The display is invoked at the specified time (within 10 seconds). Ad callouts are not affected by scroll activity. 


<script> //<![CDATA[

  /* Lazy Load Ads with Timer by igniel.com */

  let lzAdTime = 6;

  setTimeout(() => {

    Insert Your Basic Script Here 

  }, lzAdTime * 1000);

//]]> </script>


Info Change the number in the lead time as desired. In the example, the number 6 means 6 seconds.



that's how to install lazy load adsense,that's all I can say in this article.


Reference: https://www.google.com/
https://www.igniel.com
Blogger
Join the conversation
Post a Comment