customisable counter
How do I fetch multiple ads in one ad call? / General Questions - Publishers / Knowledge Base - Trafficspaces Support

How do I fetch multiple ads in one ad call?

Trafficspaces has a great feature that lets you fetch multiple ads very quickly.

If you have say several ad zones on your page, it is inefficient to fetch them one by one. We recommend that you make a single ad call that fetches all ads.

Getting Started

To fetch multiple ads, you need to grab the Advanced Ad Tag from the Setup->Ad Zones->Ad Tag->Advanced section.

The Advanced Ad Tag consists of three separate codes all of which must be inserted into your page.

How it works

  1. The first code make a call for the Javascript library that controls how ads are displayed. It also contains any ad targeting settings you've enabled. It should be inserted only once in your page. You can insert it into the or sections of your HTML but make sure it is inserted before any of the other codes.

  2. The second code creates a placeholder for the ad zone. It does not fetch or display the ad. You can repeat it multiple times in your page for each ad you wish to display. Note: The ad server will only return up to 20 ads per call.

  3. Finally, the third code fetches the ads from the ad servers and displays them in every placeholder you've created. It should be inserted only once after all the insertions of the second code.

`

<html>
<head>
   <script src="http://ads.trafficspaces.net/adservice.js" type="text/javascript"></script>
   <script language="Javascript">
    TS_AdService.flags = {
    "interests" : [],
    "interval" : 300
    }
   </script>
</head>
<body>
   ...
   ...
   <!-- This creates a placeholder for the first ad zone -->
   <script language="Javascript">TS_AdService.CreateZone("1111111111111");</script>
   ...
   ...    
   <!-- This creates another placeholder for the same ad zone -->
   <script language="Javascript">TS_AdService.CreateZone("1111111111111");</script>
   ...
   ...    
   <!-- This creates a placeholder for the second ad zone -->
   <script language="Javascript">TS_AdService.CreateZone("2222222222222");</script>
   ...
   ...    
   ...
   ...    
   ...
   ...    
  <script language="Javascript">TS_AdService.FetchAds();</script>
</body>
</html>

`

Benefits

  1. It is much faster because it reduces several round trips to the ad servers to just one call.
  2. It creates a better user experience because there are fewer blocking calls thereby causing your pages to load faster.
  3. It allows you to ensure that duplicate ads do not appear.
  4. If you prefer, it also allows you to ensure that all ads are related to a single advertiser or a single campaign.