[ic] Session Referer not as Expected

Orko interchange-users@interchange.redhat.com
Sat Mar 30 14:53:00 2002


I have noticed that in my catalog, the referer of a particular user is
stored in their session.  We have multiple sources of traffic that we
want to track and measure performance on.  The problem is that we are
seeing orders from users seemingly coming from a referer that couldn't
possibly be pointing to the place they came in at in the catalog.

The possibility of page caching had been discussed, but further tests
and looking through the Vend::Server and Vend::Session modules made me
believe that if a user's session hadn't expired yet, the referer that is
used for them is the one that they *first* came in with when their
session was started.  Our user's sessions expire after 24 hours
( SessionExpire   86400 ), and I run a 'ICMAIN/bin/expireall -r' every
hour on the crontab.  I also purge my tmp and session directories of
files over 3 days old every night during the slow traffic periods.

Anyway, to test the referer theory, I made up a quick test page with
only this:

[calc]
  $ref = $Tag->env('HTTP_REFERER');
  $Session->{referer} = $ref if ( $ref );
  return $Session->{id}.'::'.$Session->{referer};
[/calc]

( The env usertag is something I got from Ed, and it works like a charm
on getting to the Apache environment variables. )

This test looked good.  My referer was changing everytime I came in, and
my session ID was not.  So I commented the second line out:

[calc]
  $ref = $Tag->env('HTTP_REFERER');
#  $Session->{referer} = $ref if ( $ref );
  return $Session->{id}.'::'.$Session->{referer};
[/calc]

and coming in from multiple sources, my referer stored in the session
did not change with that line commented out.  With it uncommented, it
works like I would expect an Apache referer to work.  Stating the page
that you came in from.

Now, I do understand that the referer stored in their session is there
so we can know where they came *into* the cart from, as opposed to where
they were in the cart when they ordered.  What I would like, however, is
to have a record of the *last* referer they came in from on this
session, not the *first*.  I haven't been able to figure out a way to do
this other than the above "hacky" way of doing it on every page I have
entering into the cart, being careful not to overwrite the referer with
a blank or catalog owned URL.

Is there somewhere central that I could tell IC to reset the referer if
it has changed, is valid and is not a cart referer?

Thank you,

-- orko