Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 1st, 2003, 12:57 PM
Registered User
 
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default track how many times the site is visited

Hi,

I am thinking to write a program to keep track of how many times my web site is visited (my web site is written in ASP).

I appreciate any suggestion.

Cindy
 
Old August 1st, 2003, 04:16 PM
Authorized User
 
Join Date: Jul 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ALoPresto
Default

Create an application-level variable and whenever a page is opened, increment the variable. This is a very low-tech approach which you should improve on.

Example:
Code:
Global.asa
----------

<SCRIPT Language="VBScript" RUNAT="Server">
Sub Application_OnStart ()
     Application("NumUsers") = 0
End Sub
</SCRIPT>


Increment.asp
-------------
<%
'include this file in every page which you want to track
Application("NumUsers") = Application("NumUsers") + 1
%>

Normal.asp
----------
<%
Option Explicit
'this is one of your pages which you want to track users. 
%>

<HTML>
<HEAD><TITLE>My Page</TITLE></HEAD>
<BODY>
<%

Response.write Application("NumUsers") & " have visited this page."

%>
</BODY>
</HTML>
Note that this will count every user to every page as one hit. So if a user looks at 5 pages, it will increment the total by 5, but it won't track each page separately. To do that, just make an array at the application level, and assign a number to each page you want to track. Then increment that cell of the array on the individual page.

Hope this helps.
 
Old August 4th, 2003, 02:12 AM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think there is a more smart way to do so...

1. In Global.asa:

<OBJECT RUNAT=SERVER SCOPE=Session ID=objCounter PROGID="MSWC.PageCounter" VIEWASTEXT>
</OBJECT>


2. In the place where you wonna show number of wisitors



You are <b><%= objCounter.Hits %></b> visitor of this page!.



3. Also in Global.asa

Sub Application_OnStart()
'On Error Resume Next Uncomment this line in realise version of application
    Dim sSQL
    'uncomment next line for visitors counter reset
    [u]'objCounter.Reset</u>
'for localization & adaptation change data below
    'set Russian locale id
    Session.LCID = 1049


Of course you need IIS 5.xxx

 
Old October 4th, 2003, 03:09 AM
Registered User
 
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Dr Robert James Send a message via AIM to Dr Robert James Send a message via MSN to Dr Robert James Send a message via Yahoo to Dr Robert James
Default

Hi
how can i need a script in global.asa to
track no of ACTIVE visitors on my site.
Many people helped me this.
.............................
But i also want to know the active visitor
with
ip , date, time.
As i am running my IIS server.
Thanks
..............................


Robert James
MD (Internal Medicine)
Ph:919814118442
Email:
[email protected]
 
Old October 6th, 2003, 12:06 AM
Authorized User
 
Join Date: Sep 2003
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to zaeem Send a message via Yahoo to zaeem
Default

Hello Thanks for ur help regarding active visitors. But can anybody tell me where to write GLOBSL.ASA should it be written in every pages.
Or just include in the everypage. Any help is appreciated.
Bye

Zaeem Sherazi





Similar Threads
Thread Thread Starter Forum Replies Last Post
a:visited link clearing vferratusco CSS Cascading Style Sheets 8 June 16th, 2010 11:20 AM
Visited link Issue mat41 CSS Cascading Style Sheets 10 May 14th, 2008 07:42 PM
Retrive Visited URL from FireFox senpark15 C# 2005 4 April 10th, 2008 12:35 AM
Chapter 3 - a:visited not working VeganMan BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 4 April 3rd, 2008 12:31 AM
Have robots visited my site angrycat Apache Tomcat 2 February 22nd, 2005 09:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.