![]() |
|
|
Published: Thursday, April 29, 1999 We've all seen the sites which have nifty rotating banners. Each page you visit, you see a random advertisement at the top. If you click on the banner, you are taken to the advertiser's website. If you've ever considered adding such a system to your own site, you are in luck, because Microsoft provides a component that makes banner rotation painfully simple.
The component from Microsoft is called the Ad Rotator, and comes standard with ASP. (This means that your web host provider more than likely has this component available for you to use!) The Ad Rotator isn't a solve-all; for example, the Ad Rotator doesn't track banner impressions and click-throughs. (However, with a little tweaking, we can keep track of some of these statistics.) First off, you will need to create a text file which stores all of your banner information. This file is known as a Rotator Schedule File. The first four lines of the file are optional, but can be:
REDIRECT redirect URL
These parameters effect all of the banners listed in this file. So, if
you set The next line in the file is mandatory, and must be present even if the above four lines are not! The symbol is an asterik (*). After the asterik, for each banner in your rotation, you will need four lines. The first line is the location of the advertising image; the second line is the URL you want the visitors to be sent to once they click on the banner; the third line is the alt field text you want for the banner (this is the text that will show when the user moves his/her mouse over the banner); the fourth line is a numeric value signifying how often you want the banner to be displayed (a number signifying the probability of the banner being shown, a value between 1 and 100 (100, it's shown 100% of the time; 50, it's shown 50% of the time, and so on)). For each banner that you want in your rotation, you simply repeat the four needed lines. Below is an example, one that uses the five global properties as well:
This file would have three banners in its rotation, with banner1 showing up 20%
of the time, banner2 showing up 30% of the time, and banner3 showing up 50% of
the time. Whenever a user clicked on any of these banners, the user would be
redirected to Now, let's look at the ASP needed to display a random banner, it's rather quite simple. Remember, this code needs to go in the .ASP file that you want to have display a random banner:
That's it! (Here,
The method
If you have specified a This will send the user to the correct URL for the banner that was clicked. If you want to track click-throughs, you can do so in the redirect file (either through the user of text files or through a database). In an upcoming article, I will show you how to have an advertising system which keeps track of impressions and click throughs, and presents a nifty little report for the advertisers to see how their advertisements are doing. I hope I've answered any questions you've had about Ad Rotator, and how to add rotating banners to your ASP site! Have a great day and Happy Programming!
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||