Use Collapsing Ad Unit In Google Adsense To Hide The Public Service Ads (PSA)

Google AdSense is a massive online advertising network. For each ad space inventory, it has highest fill rate. The fill rate is based on visitors from North America, US or Europe and global traffic.

Sometimes it is also possible that when AdSense crawler checks the webpage, it may fail to find any related ad to display. In such situations Google AdSense Public Service Ad, which is usually called as PSA, is displayed until an alternate URL for ad is specified.

There is one more choice for the bloggers, webmasters or publishers when there is no alternative ad that is available for display. When an alternative advertisement is not present to display, the ad space is filled by a solid color (by using google_alternate_color JavaScript variable). In some cases a public service ads will be displayed, but it is not be paid for the clicks anyway. In such conditions a choice for collapsing ad unit is offered by Google AdSense.

Collapsing the ad unit is an advanced feature which is optional for the alternative ads. This feature has a code for collapsing ad unit which will ‘collapse’ the ad unit. The feature allows you to minimize an unused, blank or un-monetizing space which would be replaced by using alternate colors.

The activities of collapsing ad unit works only on the websites that are hosted on their own servers by own domains or subdomains. It works on those websites which are able to allow remote or console access (remote access is possible via SFTP or FTP, SSH or Telnet).

The main reason for this is because some a script file must be uploaded and then hosted on each domain and sub-domain locations. After this to implement the collapsing ad the location is referenced by the alternate ad URL. So this feature cannot be utilized by users of,, and etc.

Follow the steps given below to collapse the add unit.

  • Download the collapsing ad units file and right click on link Here ‘Save Target as…’: google_adsense_script.html.
  • Upload the file google_adsense_script.html on a domain to any location for applying the collapsing ad unit. The location of the file exists on the similar domain with the webpages so that it is not so important. The HTML file is necessary for multiple domains or subdomains.
  • Then login to your AdSense account.
  • Go to AdSense Setup and click on Manage Ads. Then go to Edit Ad Settings of the ad unit so as to apply the collapsing on no ad instances.
  • Go to “More options” section and select on the tab named as “Show non-Google ads from another URL”. Enter the unchanged and full path to the collapsing ad units HTML file which is present on your domain.

When you add an alternate URL pointing to the collapsing script on the ad unit code, the ad unit will disappear when there is no targeted ad available. All he unused add units are appeared as empty, transparent boxes in Internet Explorer 5.0 or lower version.

Below is another code which is provided for the users who can not transfer or upload the HTML file to the web server. You can use the code if you have console access and able to Telnet or SSH into host.

First of all, create a new google_adsense_script.html with the help of VI (which is present on the web root directory of server). Then copy and paste the content given below:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“ “>
<html xmlns=”” xml:lang=”en” lang=”en”>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1? />
<script src=”” type=”text/javascript”></script>
<body style=”background-color: transparent;”>