How to use ASP to write the website statistic System (ii) (Transfer from Gaoshan)

Source: Internet
Author: User
Tags string format
Statistics how to use ASP to write Web site statistics System (II.)

1. Obtain the user's operating system.
Use the following statement in the ASP to get the Http_user_agent string for the visitor.
Dim struseragent
Struseragent=request.servervariables ("Http_user_agent")
This string is typically in the following format:
mozilla/4.0 (compatible; MSIE 4.01; Windows 98)
The string above can indicate that the visitor is using an operating system that is Windows98 and the browser is MSIE 4.01, but the string format is not fixed and can be changed on its own.
Some of the other major useragent strings we've seen are as follows:
Use IE's browser:
mozilla/2.0 (compatible; MSIE 3.01; Windows 95)
mozilla/4.0 (compatible; MSIE 4.0; Windows 95);
mozilla/4.0 (compatible; MSIE 4.01; Windows 98)
mozilla/4.0 (compatible; MSIE 5.0; Windows 98);
mozilla/4.0 (compatible; MSIE 5.0b2; Windows NT)
Using Netscape's browser:
Mozilla/4.03(en) (WIN95; I)
Mozilla/4.08(en) (WinNT; U NAV)
Mozilla/4.5(en) (WinNT; U
Mozilla/3.04gold (WIN95; I)
Using Opera's browser:
mozilla/4.0 (compatible; opera/3.0; Windows 3.50B10)
FrontPage Editor:
mozilla/2.0 (compatible; MS FrontPage 3.0)
Using the Sun operating system:
Mozilla/3.01gold (X11; I; SunOS 5.7 i86pc)
Mac machine with PowerPC:
mozilla/4.0 (compatible; MSIE 4.5; MAC_POWERPC)
By analyzing the strings above, we can find the rules, write a subroutine to determine what kind of operating system the visitor is using, and because the browser-type control in the ASP needs to update the Browser.ini file, we can combine this string to determine the browser properties.

2. What kind of way do we use to count websites?

We can have the user add the following statement to his home page:
<a href= "Http://www.abc.com/viewer.asp?userid=username" ></a> above userid is a specific user, pay attention to users and visitors is not a concept.
Through the string above we can collect the user's access data, and provide users with a link to view the data. When we see the page with NetEase's statistical system, we will find that it will return to the user an icon, we can implement this function in the counter.asp.
Add: Response.Redirect "Abc.gif"
This statement can be added to the user after the collection of statistical data.
The next story is how to design the data table structure.




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.