Forum Moderators: coopster

Message Too Old, No Replies

Track pages viewed in a session

Track the pages viewed in a session before submitting the form

         

seo24x7

12:47 pm on Sep 26, 2007 (gmt 0)

10+ Year Member



I would like to track the pages viewed by a customer before contacting us through a form. Basically, I want to build a system wherein I can see the Title of pages viewed by a Customer along with the deatils he entered in the contact us form.

I am open suggestions on cookie based tracking or session based tracking. My site is in PHP and I use MySql to store the contact form data.

Any help will be highly appreciated.

Thanks

jatar_k

12:48 pm on Sep 26, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could add pages viewed to the session and then dump those into the posted data when they submit your contact form

seo24x7

12:52 pm on Sep 26, 2007 (gmt 0)

10+ Year Member



How would I do that?

I am sorry but my knowledge with Php and Javascript is very limited.

If you can point me a resource, it will be great. Thanks Jatar

jatar_k

1:01 pm on Sep 26, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could do it a bunch of ways I guess

something very simple would be at the top of every page

session_start();
$_SESSION['visited'] .= ',' . $_SERVER['PHP_SELF'];

this should just keep appending the name name of the next page visited to a session var, ending up with a comma delimited list of pages

then on your form you could have

<input type="hidden" name="visited" value="<?php echo $_SESSION['visited'];?>">

which would submitted with your form

you really need to look at sessions and how they work and are configured though as this isn't a hugely efficient way to do it
[php.net...]