ASP - Ad Rotator Component

The Ad Rotator component allows Web developers to put together a list of banners and special placeholders on their pages for these banners. Then, the Ad Rotator component randomly selects a banner and places it in the appropriate placeholder. The select isn't quite random, as you can specify the relative frequency of each banner - one banner may be displayed twice as often as another, and so on.

The drawback of the Ad Rotator component is that it wasn't designed to tune the ads to the viewers. You can't replace the ad selection algorithm with one that takes into consideration the time of the day, the viewer's domain, and so on.

To use the Ad Rotator component, you must create the following:

  1. The Banner's Placeholder A placeholder (or multiple placeholders) for the banner on your page. This placeholder is a rectangle of specific dimensions, and all banners must fit in these dimensions. The banners themselves are images, usually animated GIFs. If they're not all the same dimensions, they'll be resized to fit the placeholder and be distorted in the process.
  2. The Schedule File A text file with the banners you want to display. This file contains the names of the image files with the banners, the destination of each banner (if any) and the relative frequency of each banner. The syntax of this file is straightforward (one item per line) , but it must be absolutely correct. Miss a line in this file and the Ad Rotator component will be totally confused. This file is the Ad Rotator's Schedule file.

  3. A Typical Ad Schedule File: AdSchedule.txt

     

    1. RedirectionScript is the path and name of the Redirection script on your server
    2. The width of Banner's placeholder
    3. The height of Banner's placeholder
    4. The border width of Banner's placeholder (in pixels)
    5. The banner detail The first banner detail must follow asterisk(*) and each of them contain 4 lines:
      1. The URL of the banner's image
      2. The URL of the destination of the banner (this is the advertiser's home page address)
      3. A short string about the ad. This string will appear in a tip box when the viewer hovers the pointer over the banner.
      4. The relative frequency of the banner. If the Schedule File contains three banners and their relative frequencies are 2, 1 and 1, the first banner will be display twice as frequently as either of the others.

     

  4. The Redirection Script A script that processes each request on your server before redirecting the viewer to the site of the selected banner. This script could store information about the traffic generated by your site to the advertised sites. The information can be store in a text file or to the server's log file.

Example

<%
Set AdObj = Server.CreateObject("MSWC.AdRotator")
ScheduleFile = "Ads/AdSchedule.txt"
adString = AdObj.GetAdvertisement(ScheduleFile)
Set AdObj = Nothing
%>
<HTML>
<CENTER>
<H1>Ad Rotator Example</H1>
<HR>
<%=adString%>
<BR>Click on the banner above to visit our sponsors.
</CENTER>
</HTML>

Output