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 "Ad Tag 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 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.<!-- AdSpeed.com 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> <!-- AdSpeed.com 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 callsAdSpeed_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&oid=XXX&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, callAdSpeed_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. 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.
- Accelerated Mobile Pages Project - AMP Ad Tag
- Can I have ads refresh automatically without a page reload?
- How can I avoid document.write warning in Chrome?
- How can I avoid duplicate ads on the same page?
- How can I combine multiple ads in the same placement?
- How can I defer ads until after the page has finished loading?
- How can I display an ad only when it is visible on screen?
- How can I measure ad viewability?
- How can I mix ad dimensions or mix banners with text-link ads?
- How can I put ads into my blog/website?
- How can I serve multiple ad dimensions in the same place?
- How can I support click tracking for external ad servers?
- How can I turn off ad serving error messages?
- How do I add current timestamp into the serving code?
- How do I display mobile ads using Android WebView?
- How do I display mobile ads using Apple iOS WKWebView?
- How do I integrate AdSpeed mobile ad serving API?
- How do I make ads responsive on mobile devices?
- How do I pass custom data and variables into the ad?
- How do I set up advertising on WordPress?
- How do I setup a companion ad in video ad serving?
- How do I setup a passback ad tag?
- How do I switch to secure SSL/https ad serving?
- Should I use protocol-relative URLs in ad tags?
- What are custom ad serving settings and variables?
- What are different formats of serving code?
- What are different types of ad tag?
- What are the effects of ad blocking software?
- What is the pop-up and pop-under ad tag?
- What is the serving code or ad tag?
- What is WMODE for SWF ads? How can I change it?
- Where is the publisher-side file for iframe busting?
- Why doesn't the provided HTML serving code work?
Cannot find an answer for your question? Ask our Customer Care team
Related
- Campaign
"Documentation for API methods to manage your campaigns in our ad server. API Version1.4.6 (build 20240530). This page was updated ..."
- Composite Ad
"A composite ad is made up of other ads. This ad type is useful for a big ad widget that ..."
in Ad Gallery - How can I defer ads until after the page has finished loading?
"Typically, content is loaded according to the components' order in the HTML source code. If you want visitors to see ..."
- How can I display an ad only when it is visible on screen?
"Typically, when you first load a web page, all ads are loaded simultaneously along with all other components and contents ..."
- Website
"Documentation for API methods to manage one or multiple websites. API Version1.4.6 (build 20240530). This page was updated on Mon, ..."