[This is preliminary documentation and subject to change]

## Ad Rotator

###### Overview

The Ad Rotator component creates an AdRotator object, which automates the rotation of advertisement images on a Web page. The component is designed to display a new advertisement each time a client browser opens or reloads a Web page.

###### Code Tour

This sample demonstrates how to use the Ad Rotator component. The script itself is simple, creating an instance of the AdRotator object and calling the GetAdvertisement method each time the page is loaded. GetAdvertisement returns a single ad entry from the Ad Rotator schedule file, adrot.txt in this example, and the special script delimiter <% = ... %> displays the results to the client browser.

The schedule file for this sample, adrot.txt, is relatively straightforward. The four lines above the asterisk (*) are global file settings that affect all schedule entries in the file. The most interesting and useful global setting is the redirection specification. In this sample, if a user clicks on the advertisement, no matter which particular entry is currently displayed, the user will be transported to the .asp file indicated. These scripts, or DLLs, usually count how many hits a given ad has received, collect user information, and then extract the URL from the request and redirect the client browser once again to the URL that was originally requested.

Each of the entries that occurs below the asterisk consist of four lines, denoting the image to be displayed, hyperlink, alternate text, and the relative probability that that particular entry will be displayed on any given visit to that Web page. Thus, the Microsoft® Internet Information Services image has an 80 percent chance of being displayed with each hit on that page, while the Microsoft Internet Explorer image will be displayed for only 20 percent of the hits.

Note If an advertisement entry in the schedule file does not have a corresponding URL, the hyperlink line of the entry must contain a hyphen (-) or the Ad Rotator component will return an error.

© 1997-2001 Microsoft Corporation. All rights reserved.