ASP Getting Started tutorials-Advertising wheel display components

Source: Internet
Author: User
Tags file url

The Advertisement Wheel display component (Ad rotator) is used to create an instance of an AdRotator object that automatically rotates an advertisement image on a Web page. Each time a user opens or reloads a Web page, the component displays a new advertisement based on the information specified in the Rotator Schedule file. The way to use the advertisement wheel display component is as follows:

1) Create AdRotator object;

2) Gurney an advertisement in the Display list file;

3 Create a display list file and a redirected file.

1. Create an advertisement to display an object instance

Use the Server.CreateObject method to create an advertisement wheel display (AdRotator) object instance. The syntax format is as follows:

Set ad=Server.CreateObject("MSWC.AdTotator")

Here the Set command is used to combine with the Server.CreateObject method to create a MSWC. A reference to the AdRotator object. The advertisement wheel display component has a GetAdvertisement method that getadvertisement the method management and Gurney the list file to check for information, such as when the user opens or refreshes a page, and the method gets the next ad that is arranged. The syntax for the GetAdvertisement method is: AD. GetAdvertisement ("filepath")

Note: AD is an ad instance created using the Server.CreateObject method; filepath is the virtual path for the advertisement wheel to display the list file.

The following script displays different ads each time a user views a Web page.

   <%
   Set ad = Server.CreateObject ("MSWC.AdRotator")
   Response.Write ad.GetAdvertisement("/ads/adrot.txt")
    %>

2. Create a turn-list file

A wheel-display list file is a file that manages the display frequency or displays information about various ad images. It is made up of two parts, the first part setting parameters that apply to all the ad images in the rotation arrangement; the second section specifies the file, location information, and percentage of each display time for each ad. The two parts are separated by rows that contain (*). The file must be available on a virtual path on the WEB server. The syntax format is as follows:

[Redirect URL]
       [Width numWidth]
       [Height numHeight]
       [Border numBorder]
       *
       adURL
       adHomePageURL
       Text
       impressions

The first four lines of code contain the global settings for the advertisement:

1 Redirect URL indicates that the advertisement will become its hot connection URL. But it is not a direct jump URL, it contains two parameters of the query string: The specific Ads home page URL and image file URL. These values can then be extracted in the redirected file, and the redirect file can do other work, such as tracking the number of times the ad is clicked, jumping to the accepted AD home page, and so on.

2 width, height, border Needless to say a look at the picture is connected to the width, height and the size of the border line.

The "*" symbol indicates the separator, and the details of each advertisement are described in one unit per four behavior under the "*" number. Each of them represents:

1 Specify the location of the advertising image file;

2 the homepage URL of the Ad object (if the advertiser does not have a home page, the behavior is a hyphen "-", indicating that the advertisement has no link;

3 The alternative text of the image;

4) Impressions points out the relative weights of advertisements. For example, if the Impressions list file contains 3 advertisements with 2, 3, and 5 respectively, the 1th advertisement occupies 20% of the display time, 2nd occupies 30% of the display time, and the 3rd occupies 50% of the display time.

3. Create a redirected file

This page main function: Extracts the URL parameter value, jumps to the advertisement homepage. The syntax format is as follows:

      <% whaturl=request.querystring("url") %>
      <% response.redirect whaturl %>

The function is simple to complete. Of course, this page can also do some other events: tracking the client clicks on the ad, such as the acceptance of the same URL address to the accumulation of the number, you can show the number of clicks on the site ads.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.