logo Ad Management System

How can I serve multiple zones with a single server request?

This method is highly recommended if you have 3 or more ad placements on a page. It combines all ad calls into one and can speed up ad delivery significantly. For example: if your web page currently has 5 ad calls for 5 ad placements, it can be combined into one call and up to 500% faster overall.

How it works

Instead of requesting an ad from the ad server for each ad placement, this approach combines multiple calls into a single call to get all ads in one shot. Each ad placement then calls a JavaScript function to actually display the ad. Each ad is tracked separately for both impressions, clicks and other ad metrics. This method has 2 parts: preparing ads and displaying each ad.

Wizard

For your convenience, we have a wizard so that you can enter your own zones and it will generate the suitable ad tags for you. Please follow the instructions below:

Below is an example of the 2 steps that are generated from the wizard:

Step 1. Preparing Ads

This code gets ads from multiple zones in a single call to our ad server. It should be placed once into your HTML web page before the ad placements. It could be inside the HEAD element or just before the first ad placement of the page.
<!-- AdServer Serving Code 7.9.4 for 3 zones [Any Dimension] -->
<script src="//g.adspeed.net/ad.php?do=js&oid=XXX&zids=1234-2345-3456&wd=-1&ht=-1&target=_top" type="text/javascript"></script>
<!-- AdServer End -->
The parameter zids has multiple zone IDs (eg: 1234, 2345 and 3456) separated by hyphens "-". Change them to your own zone IDs and change oid to be your account ID. For your convenience, you can use the wizard (see above) to fill in these values.

Step 2. Displaying each Ad

Each ad placement calls AdSpeed_display() to instantly display the already-prepared ad to the visitor's browser without any call to the external ad server.
<h1>FIRST AD PLACEMENT<h1>
<!-- AdServer Serving Code 7.9.4 for Zone #1234 [Any Dimension] -->
<script type="text/javascript">
AdSpeed_display(1234);
</script>
<!-- AdServer End -->

<h1>SOME PAGE CONTENT<h1>
Content Content Content

<h1>SECOND AD PLACEMENT<h1>
<!-- AdServer Serving Code 7.9.4 for Zone #2345 [Any Dimension] -->
<script type="text/javascript">
AdSpeed_display(2345);
</script>
<!-- AdServer End -->

<h1>SOME ADDITIONAL PAGE CONTENT<h1>
Content Content Content

<h1>THIRD AD PLACEMENT<h1>
<!-- AdServer Serving Code 7.9.4 for Zone #3456 [Any Dimension] -->
<script type="text/javascript">
AdSpeed_display(3456);
</script>
<!-- AdServer End -->

Multiple Ads per Zone

You can also use a single request to fetch multiple ads from a zone. The format uses a hyphen "-" as the zone separator and a letter "x" follows by the number of ads. Example: zids=1234-6789x2. This ad tag gets one ad for zone #1234 and gets 2 ads for zone #6789.
<!-- AdServer Serving Code 7.9.4 for 3 zones [Any Dimension] -->
<script src="//g.adspeed.net/ad.php?do=js&oid=XXX&zids=1234-6789x2&wd=-1&ht=-1&target=_top" type="text/javascript"></script>
<!-- AdServer End -->

Display Fetched Ads

To display all fetched ads of a zone, call AdSpeed_multiple(ZoneID);
<script type="text/javascript">
AdSpeed_multiple(6789);
</script>
To display individual ads from the zone, call AdSpeed_display(ZoneID,AdSlot);
<script type="text/javascript">
AdSpeed_display(6789,0); // first ad
</script>

SOME CONTENT IN BETWEEN ADS

<script type="text/javascript">
AdSpeed_display(6789,1); // second ad
</script>
To embed ad into a container, call AdSpeed_div(ContainerID,ZoneID); or AdSpeed_jQuery(ContainerID,ZoneID);
<div id="AdPlacementOne"></div>
<script type="text/javascript">
AdSpeed_div("AdPlacementOne",1234); // or AdSpeed_jQuery()
</script>

<div id="AdPlacementTwo"></div>
<script type="text/javascript">
AdSpeed_jQuery("AdPlacementTwo",6789,0);
</script>

<div id="AdPlacementThree"></div>
<script type="text/javascript">
AdSpeed_jQuery("AdPlacementThree",6789,1);
</script>

See also

If you want to delay ad display until all page contents have finished loading or auto-refresh multiple zones together, you can use the ad defer solution.

Considerations

For the best performance, only include the zone IDs that you actually want to display to the web page. This will make sure you get the fastest speed and get all the ads needed for a page load. AdServer runs through the whole ad selection process for each of the zone IDs listed. If you include extra zones without using them, time and resources will be wasted.
All rights reserved.