$_REQUEST["PHPSESSID"]."', '".$_
REQUEST['action']."', '$page',
'".getenv('HTTP_REFERER')."', '".getenv(
'HTTP_USER_AGENT')."', '".serialize($_REQUEST)."')";
$GLOBALS['db']->Query($query);
$_SESSION['tdId'] = $GLOBALS['db']->GetCurrentId();
}
Developing Standards-Compliant Sites
[ 96 ]
4. Now open index.php and call the function we just wrote. We should do it
before including the action file.
$action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "home";
$file = $action . ".inc.php";
logUserTrail();
if (in_array($action, $validActions) && is_file($file) )
{
include($file);
}
5. Now access the POTR site. Browse around on a few pages. Confirm that the
data is inserting into the table through your favorite administration tool.
6. Our tracking mechanism is now in place. After a few requests, doing a
query like SELECT userId, action, timeSpent, browser, vars from
trackingData may give an output similar to what is shown in the next
screenshot. Notice the vars field gives us values that tell us the exact action
the user was trying to perform. In the highlighted case, a non logged in user
was on the first step of the order process, and spent 4 seconds on it.
Pages:
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137