Basics of Google AdSense Ad Code

What is AdSense Ad Unit?

AdSesne ad unit is a piece of script to be embedded in your webpage in order to display ads from Google. The script will be triggered when the page is loaded which will send an ad request to the nearest Google server located. Server will return appropriate ad based on ad auction and the script will then display the ads in the webpage. Each and every ad unit in a webpage sends an ad request which is recorded in your AdSense account as ad request count.

Below is the example of how an AdSense ad script code looks like:

AdSense Ad Code
AdSense Ad Code

AdSense ad code is to be generated from your AdSense account and is to be embedded in your webpage in order to display ads on your page. Learn more creating Ad units.

Various Terms Used in AdSense Ad Code

Following is the explanation of the terms used in an AdSense ad script code.

  • Script – AdSense ad code is a server side JavaScript code embedded in any webpage. This script calls the server through API in the background and retrieve the relevant ad to be displayed on the page.
  • Ad Client – This is the publisher’s AdSense id, which can be used anonymously in any ad codes. In order to avoid misuse of the publisher code, Google introduced site authorization concept where publishers can authorize the sites to display their AdSense ads. You can add authorized sites to display your ads in your AdSense account under “Access and authorization” section available in “Account settings”.
Related:  How to Properly Setup Autoptimize in WordPress Site?
AdSense Site Authorization
AdSense Site Authorization
  • Ad Slot – This is a slot number assigned automatically by Google in order to track any particular ad.
  • Width and Height – Determines the size of the ad to be displayed in a webpage.
  • pagead2.googlesyndication.com script – This collects the information regarding the user behavior to display appropriate ads to be served for that user.

Recommended Articles:

Leave a Comment