Forum Moderators: DixonJones

Message Too Old, No Replies

Simple cookie script to determine new vs. returning vis.

javascript, cgi, cookie

         

bjorn72

4:33 pm on May 6, 2003 (gmt 0)



Hi All,

I'm looking for a small bit of ready made code to pop into my site (js or cgi) to have Webtrends pick up on whether or not a visitor is returning. Everything I've found so far gets cute i.e. Communication with the visitor, "You've been here 400 times", or worse,"Hello returning Websurfer".

Does anybody have anything that I can beg, borrow or steal?

Thanks,

Bjorn

Mike12345

3:37 pm on May 7, 2003 (gmt 0)

10+ Year Member



Set the cookie at the begining then insert the code along the lines of the following. Set the expiry date nice and long, and if they dont clear the cookies then it will work for donkeys.

<script language="JavaScript">
if (document.cookie == 'cookie.name')
alert("Blaa blaa blaa");

</script>

or have an event as an else, or instead of an alert have something mroe intersing. It might be a little simple for what you need but its a start. Somebody will have a better idea, you should get sopme more input while its at the top of the pile.

:)

<added>Welcome to webmasterworld</added>