![]() | Pepper Spray & Stun Gun Specials! KEEP THEM SAFE. | |
| CoverYourASP --> Advertising --> Part 3: Managing clickthroughs | ||
| Managing impressions and clickthroughsIn Part 1 we saw how BannerCounter.asp was referenced in the banner HTML we output. Here's how that file works to count the impressions and clickthroughs, and redirect the clicks to the advertisers URL. BannerCounter.asp is an asp page, but one that outputs no HTML. Simplified source is shown below (you can download the real thing later).
This file is called in two different ways. The first way is as the target of an <img> tag, where it simply increments the impression counter in the database. The second way is as the link the banner points to, where it increments the clickthough counter and then redirects the user to the advertisers URL. The difference is the number of parameters sent in the QueryString. If no "CYAredir" is passed in, then I'm in impression mode. In this case the code above sets sVariable to "ImpressionCount", the name of the field in the BannerStats table that we want to increment. This field is then incremented in the record for that banner on todays date. We'll see how that record gets into the BannerStats table in a minute. If there is a "CYAredir" parameter passed in, the "ClickCount" is incremented instead, and then Response.Redirect is used to redirect the user to the advertisers URL. |
| |||||||||||||||||||||||||||||||||||||||||||||||||