Forum OpenACS Q&A: Cookies and Session Tracking

Collapse
Posted by MaineBob OConnor on

We have a set of pages that we show to casual users before we ask them to log on and get one of our delicious cookies. (OpenACS 3.x)

Now, for Marketing purposes. we plan to serve up 3 different home pages randomly to first time site visitors to find which page results in the visitor becoming a registered Guest and later a paying Member.

After seeing one of the home pages, the user can wander around and see dozens of pages without a cookie. So what I need is a way to track this information.

  1. My first thought is a url var: .../?home=1 that is passed around to the dozens of pages and when they finally register, store the variable in the users table. This is a very tedious solution requiring editing of every page and every link so it includes the url var.

  2. My second thought is to use some unique session token. There is a table called sec_sessions that contains:
    session_id: 1796861 
    user_id: 
    token: Y4hhWtqk4Nl.R3
    secure_token:
    browser_id: 221333
    last_ip: 66.186.172.150
    last_hit: 1014337810

    I haven't quite groked how this works with what appears to be captured, but maybe I could add a column to track page 1,2 or 3, do a lookup by __?__ as soon as the visitor finally registers, then store the page number in a more permanent location such as a new column in users.

    So, is a row inserted into sec_sessions for EVERY hit to our site and where is the code that does this? I noticed that the number of rows appears to be relatively small, so the rows must be deleted at some interval.

  3. Third, Maybe it would be better to construct a new table that stores some unique id and page number for ever hit to these three pages. What is unique for the session. Could it be the IP address (ns_conn peeraddr) plus the "browser id"? Where does the Browser id come from? Is a new one generated for each browser instance? and what is the call to get it?

Or a better solution offered by a comunity member...

TIA

-Bob

Collapse
Posted by Torben Brosten on
Bob, since storage and duplication of files is cheap (only a few), one could create a "browse site" customized for each of the 3 first pages.  --a directory dedicated to each of the first 3 pages, with an accompanying set of pages to browse.  Each "sub site" would contain the browsing user until they click on a link to signup/register. The signup link could then contain the info needed to track which set the browser is coming from.

Just a thought... let me know if my description is unclear..