SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    South-West UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unique visitors hit counter?

    Hello all,

    Is it possible to create a unique visitors hit counter in ASP?

    I'm struggling to find any tutorials on the net. I found a few that can do a unique visitors on a daily basis but I just need a straight forward unique visitors in general.

    Any pointers to tutorials / scripts would be greatly appreciated.

    Thanks
    Matt

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the best way imo would be sessions...but if they come back after your session time out they will create another hit.

    you could also try cookies - just wack a long expire date on it.

  3. #3
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe Request.ServerVariables("REMOTE_ADDR") could be used in some way?

  4. #4
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Firstly it is important to point out that what you want is not actually possible - the best you will get is an approximation of the unique number of visitors (which is good enough).

    This is because even though you can set a cookie (with a long expiry) so that you can indentify a returning vistor, with a unique value, a large number of web users regularly clean out their cookies for a multitude of reasons (some valid, others in reaction to "cookies are evil"-type scaremongering by those who should know better).
    (That's the way the cookie crumbles!!! )

    However, a guesstimate of unique visitors is better than no figure at all, so that'll have to do.

    Grabbing the IP or hostname of the computer won't help because these are not unique - entire corporations/businesses/schools often access the internet via a single IP (this is how gateways/routers work). Also, on most standard dialup accounts and some broadband accounts, the IP is not static, and so a single user/browser could take on any number of IPs over a period of time.

    As an aside, it is / was possible to uniquely identify IE browsers via a feature in a Media Player ActiveX control that yields a unique value (GUID) for every computer that has it installed, but use of this feature is not strongly opposed by users in the know because of its obvious privacy implications! It is also is limited to IE only, and a patch was issued to disable this feature which doubtless will have been installed by a large number of users (although not all).

    Even if you were to make use of this feature, you would need to log each browser' GUID in a database, and query it for every hit in order to determine whether the visitor was unique or not. This would quickly become a huge database on a popular site, and speed/efficiency complications would ensue accordingly (unless you had a SERIOUSLY BEEFY setup), so don't even think about it!!!

    Ok, end of lesson!!!
    Last edited by M@rco; Sep 12, 2002 at 16:05.
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  5. #5
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    South-West UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the explanation Marco,

    I'm touched that you went to so much trouble just to explain all that....

    Nice one...
    Thanx

    Matt

  6. #6
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Counting logged in users only, will this give a correct number?...
    No: http://www.sitepointforums.com/showt...115#post552476
    ("temporarily borrowing XXX's login...")

    Anyway, the IP can be interesting if you want to count sessions by network location
    Reports with lines like "China with 13 sessions.(0.02 % of traffic)" are really amusing

    But M@rco is right, as always, the best you can get is an approximation

  7. #7
    Froot r gewd SubKamran's Avatar
    Join Date
    May 2002
    Location
    North Star State
    Posts
    597
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by jofa
    Counting logged in users only, will this give a correct number?...
    No: http://www.sitepointforums.com/showt...115#post552476
    ("temporarily borrowing XXX's login...")

    Anyway, the IP can be interesting if you want to count sessions by network location
    Reports with lines like "China with 13 sessions.(0.02 % of traffic)" are really amusing

    But M@rco is right, as always, the best you can get is an approximation
    How do you do that? (13 sessions from USA [ 23.4% ] ???

    That would rock for my site
    "Sometimes little is more."
    Kamran A
    Web Dev/Designer
    Keyboard not found: Please Press F1 to Continue

  8. #8
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How to lookup an IP and get the country code; you can do it in many ways...

    Post a request to some online ip lookup service and extract the address info from the response
    Example; if you want to lookup 193.0.0.3, then send
    http://www.ripe.net/perl/whois?searchtext=193.0.0.203
    and you will get a response containing
    inetnum: 193.0.0.0 - 193.0.1.255
    netname: RIPE-NCC
    descr: RIPE Network Coordination Centre
    descr: Amsterdam, Netherlands
    country: NL

    Or store the ip netblock info in your own database
    (you can get the data from, for example, GeoIP)

    Or use a component likeActiveTarget

    Or get LiveStats from MediaHouse/DeepMetrix, and you will get a lot of information to view , including the geographic segmentation

  9. #9
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    inetnum: 0.0.0.0 - 255.255.255.255
    netname: IANA-BLK
    descr: The whole IPv4 address space


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •