Skip to Article Skip to Youtube

An analysis over Asynchronous Adsense Code


In earlier post i have given introduction about the number Adsense Code Type available and difference between the Synchronous and Asynchronous Adsense Codes. You have understood the benefit of async tag, so every one loves to add this code. Before we implement it in our blog it is good to understand the elements there in the async code.

In the current Adsense Script i.e. sync tag you can find four elements, which contains 2 Javascript elements, 1 HTML Comment, and a customized DOM Element.

  1. <script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  2. <!-- All Pages in Header Section -->
  3. <ins class="adsbygoogle" data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" data-ad-slot="84240xxxxx"></ins>
  4. <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>

Loader

The first element in the code is called as Loader as it will load the all required resources for displaying the Ad in the website. The src attribute will fetch the resources from the given value location i.e. http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js. The async is the new concept introduced which is the base of this concept it will tell the script to load it asynchronously.

Comment

The second element is the simple HTML comment code which contains the name of the Ad Unit. You can remove it while implementing the Ad Unit code in your blog.

Ad Container

The customized ins element can be referred as Ad Container element, which will hold the Ad to show off in the blog. The style attribute will indicate the width and size of the container. The server will identify the Ad Unit with the value of data-ad-slot attribute and the publisher will be justified with the value of data-ad-client attribute. Based on these data-ad-client attribute earnings will be added to the corresponding publisher and the same will be shown under the specific Ad Unit.

Pushing Script

This element contains a push({}) function which injects the Ad sources gathered from the Loader element into the Ad Container element.

We came to the end of the topic and I jotted down some points to render the Adsense ads more efficiently for better performance of your blog in the next post don't miss it.

Labels:
is the founder of AccountsGuy.Net with the view of providing Accounting and Technical support using Accounting package Tally ERP 9, and Office Tools to the people. I write articles on Accounts, Blogging, Computer Operating, and technical issues and some of my experiences on them for students, beginners. Follow our Networks or sing-up for the email newsletter below for your daily dose of Tips and Tricks.
Subscribe To Newsletters

{ 0 Comments... read them below or add one }

Post a Comment

How do you feel about this Blog Post.