Help Center Manage Your Account Ad Tag

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:
  • Follow menu "Tools / Wizards"
  • Click on "Serving Code Wizard"
  • Click on "Generate single-call serving code for multiple zones"
  • Enter the zone IDs. You can find the zone ID under the first column when viewing the list of zones from menu "Zones / All". Please enter only numbers. If you want to display multiple ads from a zone, follow the example on the form
  • Click button "Submit", the wizard will display the next 2 steps so you can paste the correct code into your website

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 the ad server. It should be placed in your HTML web page before any ad placement. It could be the HEAD element or just before the first ad placement on the page. In this example, the zone IDs are 1234, 2345 and 3456. You need to change the zone IDs to your own zone IDs.
<!-- AdSpeed.com Serving Code 7.9.4 for 3 zones [Any Dimension] -->
<script src="//g.adspeed.net/ad.php?do=js&zids=1234-2345-3456&wd=-1&ht=-1&target=_top" type="text/javascript"></script>
<!-- AdSpeed.com End -->
The parameter zids has multiple zone IDs separated by hyphens "-". For example: zids=123-456-789

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>
<!-- AdSpeed.com Serving Code 7.9.4 for Zone #1234 [Any Dimension] -->
<script type="text/javascript">
AdSpeed_display(1234);
</script>
<!-- AdSpeed.com End -->

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

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

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

<h1>THIRD AD PLACEMENT<h1>
<!-- AdSpeed.com Serving Code 7.9.4 for Zone #3456 [Any Dimension] -->
<script type="text/javascript">
AdSpeed_display(3456);
</script>
<!-- AdSpeed.com 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.
<!-- AdSpeed.com Serving Code 7.9.4 for 3 zones [Any Dimension] -->
<script src="//g.adspeed.net/ad.php?do=js&zids=1234-6789x2&wd=-1&ht=-1&target=_top" type="text/javascript"></script>
<!-- AdSpeed.com 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);
</script>

<div id="AdPlacementTwo"></div>
<script type="text/javascript">
AdSpeed_jQuery("AdPlacementTwo",6789);
</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. AdSpeed ad server 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.

Other Articles in Ad Tag

This section describes the ad tag (serving code) with basic and advanced settings. It includes common ad serving setup instructions and answers frequently asked questions when integrating the ad tag into your site, blog or app.

Cannot find an answer for your question? Ask our Customer Care team

Related