Previous in Contents Next in Contents

RecordEvent Method

The RecordEvent method logs both ad requests and clicks to the Internet Information Server's log.

Syntax

AdServerObject.RecordEvent ([Response], [CampaignItemID], EventType)

Parameters

Response

Optional. The ASP built-in Response object, used to log ad events to the IIS log file.

CampaignItemID

Optional. A long Variant specifying the number of the campaign item being logged.

EventType

A string Variant containing either "IMPR" (for impressions) or "CLIK" (for click events).

Remarks

Usually you will not need to use this method directly. The method is used in the AdRedir.asp page. In this page, the CampaignItemID is provided in the string returned by the GetAd method for ads that can be clicked.

Impression events are logged automatically by the GetAd method, so that “IMPR” never needs to be passed in directly as an EventType argument.

In order for the RecordEvent method to log the click event, you must set the logging properties for the Web site to enable URI Query.

Example

The following example shows the entire AdRedir.asp file. When the visitor clicks an ad, the visitor’s browser is redirected to this script. This script logs the click event into the IIS log using the RecordEvent method before redirecting the visitor’s browser to the click-through page for the ad using the Redirect method of the Response object.

The ciid argument is the campaign item identifier, returned by the GetAd method in creating the URL and query string passed to this page.

<%
 Set Ad = Application("Ad")
 ciid = Request.Querystring("ciid")
 url = Request.Querystring("url")
 evt = Request.Querystring("evt")
 if evt = "" then evt = "CLIK"
 call Ad.RecordEvent(Response, ciid, evt)
 Response.Redirect(Request.QueryString("url"))
%>

See Also

RedirectURL, GetAd


© 1997-2000 Microsoft Corporation. All rights reserved.