Single page call
| Note: This article is for an old version of OpenX. The latest OpenX documentation can be found at the following URLs: |
Single page call is a simple, JavaScript invocation method that uses a single HTTP request to deliver multiple banners to a web page. Instead of making several calls to the adserver for pages with multiple ads, a single call loads the page much faster, without the delays associated with rendering each zone individually.
Setting single page call options
You generate invocation code for a single page call at the "website" level, rather than at the "zone" level. In the Websites & Zones -> Website properties -> Invocation Code tab, begin by setting various options for the invocation code.
The following table describes the ad delivery options you can set for single page call.
| Parameter | Description |
|---|---|
| Don't show the banner again on the same page | Tick Yes if you do not want to show the banner more than once on this page view. |
| Don't show a banner from the same campaign again on the same page | Tick Yes if you do not want to show any other banner from this campaign on this page view. |
| Target frame | This value sets the HTML TARGET attribute in the ad code. The Default option opens the target page in a new browser tab. Alternatively, you can change it to open in a new window or in the same window. |
| Source | The source variable is used for targeting ads and can be any string. Delivery limitations (Site:Source) can match against this value and, generally, the value is different for each section or page on your site. _See also: Banner delivery limitations. |
| Show text below banner | Tick Yes if you want to display text below a banner. Enter this text in the Banner properties page. |
The following table describes the code generation options you can set for single page call:
| Parameter | Description |
|---|---|
| Include <noscript> tags | This option appends backup <noscript> tags to each of the ad code blocks and is on by default. |
| Generate code for use on SSL pages | This option creates tags which will not generate security warnings when served on SSL pages. |
| Include comments | Removing comments from the ad code reduces the amount of code in your web pages. However, before you remove comments, review them carefully because they contain important information about the code. After you have set and reviewed the comments for all optional parameters, you can then tick No to remove them. |
When you have set all the options you require, click Generate to create code blocks for you to insert into your web pages.
Standard usage
Single page call generates two types of code block:
- Place the <script> call in the <head> section of your web pages.
- Place the JS function "OA_show(zoneid)" in the HTML at the point where you want to show the specified zone.
Script call
The script call must be included on every page which contains ads and must appear before any code blocks are called. For this reason, OpenX recommends that you place the <script> call in the HTML <head> tag. You use the same script call for every page with ads on your site.
Example <script> tag:
Ad code
As well as generating the script call, the invocation code page creates a code block for every zone on this website. Place these code blocks in the site HTML at the point where you want the banner for each zone to display.
Example ad code block:
/* [id1] Default 468x60 */
OA_show(1);
// ]]> --></script><noscript><a target='_blank' href='http://example.com/delivery/ck.php?n=SPC5c67d54'><img border='0' alt='' src='http://dev.openads.org/delivery/avw.php?zoneid=1&n=SPC5c67d54' /></a></noscript>
This standard usage limits you to placing each zone once only in the HTML for a web page because, with no additional requests necessary to reuse a code block, any repeats of the code block will deliver the exact same banner, again and again.
Advanced usage
To overcome the limitation of being unable to reuse code blocks in a web page, single page call includes an advanced feature called "named zones". To use named zones, define a list of name and zoneid pairs in a JavaScript array before the <script> call, and use these identifiers in the code blocks.
Using the named zones mechanism, you can define different names which request the same zoneid. You can also optimise the named zones array to fractionally improve performance by only requesting the zones that are present on the page.
The format of the named zone array is:
var OA_zones = {
'Banner - top' : 1,
'Banner - bottom' : 1,
'Skyscraper' : 2
}
// ]]> --></script>
<script type='text/javascript' src='http://example.com/delivery/spcjs.php?id=1'></script>
Note that both Banner - top and Banner - bottom set the same zone ID, but this mechanism will re-select an ad for the Banner - bottom position.
To use the named zones feature, you must use the "names" in the OA_show(zone) function in the ad code block for each zone.
OA_show('Banner - top');
// ]]> --></script>

RSS
Twitter
Facebook
FriendFeed