Tracking users with cookies

Results 1 to 2 of 2

Thread: Tracking users with cookies

  1. #1
    Join Date
    Dec 1969

    Default Tracking users with cookies

    I want to be able to track unique visitors via a cookie that has<BR>a unique Autonumber in it......<BR><BR>Is the Global.asa file the best place to check if a user has a cookie for the website, surely this would be(this is the first place that the user would hit)? If they do have a cookie then i could set a session variable throught the site.<BR><BR>If they don&#039;t have a cookie then just direct them to the script that will generate a cookie.<BR><BR>I&#039;m not sure what method would be best. Or should i just use an include file on each page on the website??<BR><BR>Any words of wisdom will be appreciated. <BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: Tracking users with cookies

    global.asa runs at application start and session start (if you are using sessions that is!) but I dont think that you can access/set cookies from session_onstart (at least I have never tried).<BR><BR>I would go down the include route at the top of each page.<BR><BR>This include would do the following :<BR>Is there a session cookie set?<BR>Yes : call the tracking procedure<BR>No : set a unique cookie then call the tracking procedure<BR><BR>When site tracking is required I set a variable called "page" or whatever and then use a stored proc to do all the work, then the include file is very short (just two parameter declarations, page and sessionid), but you can do all the work in ASP.<BR><BR>(as an aside you can make the include completely generic by not setting the "page" variable, but by getting the url from the server object)<BR>

Posting Permissions

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