Can someone suggest a cookie?

S

Steve Grosz

I'm trying to track if visitors to a website are new or repeat by having
a cookie set on their PC and then checking to see if its there.

I'm not sure how to do this, I don't need to record their name, etc,
just if they've visited.

Can someone suggest a way to do this? The IIS logfile analysis tool I
use, WebTrends, can use the info from that cookie, but I just need to
tell it the name, etc, then it will tell me if someone is a repeat
visitor or a brand new one.

Thanks a bunch! :)

Steve
 
J

Jim Buyens

Typically, you would add the following ASP statement to
each page you care about.

<%
Response.Cookies("beenhere") = "donethis"
Response.Cookies("beenhere").Expires = "July 31, 2004"
%>

Then, to check for a return visitor, you would code
something like:

<%
If "" & Request.Cookies("beeenhere") = "" Then
Response.Write "Hello new visitor!"
Else
Response.Write "Welcome back!"
End If
%>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
T

Thomas A. Rowe

When my host used WebTrends, it automatically created it's own cookie that indentified if a user was
a return visitor based on IP address, with the exception of AOL users, which basically all have the
same IP address.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
Top