hiks … im stack again …
I try to make a simple visitor statistic, and i have a problem.
How to make the statistic don’t update if user refresh the page ?
here my snippet
public function saveData($sid)
{
global $database;
$reff = parse_url($_SERVER['HTTP_REFERER']);
$referrer = isset($reff['host']) ? $reff['host'] : 'direct';
$own = $_SERVER['HTTP_HOST'];
if($referrer!=$own){
$ip = ip2long($_SERVER['REMOTE_ADDR']);
$time = time();
$page = $_SERVER['REQUEST_URI'];
$add = $database->tableAdd("eu_shop_pageview", "shop_id, ip, timestamp, page, referrer", "'$sid', '$ip', '$time', '$page', '$referrer'");
}
}
thanks 🙂
Regards, Stecy
Personally, when I do view tracking, I have the following columns:
Before adding to this table, I run the following query and if there are no rows returned, then I insert into that table to add a view to that page:
You would want to change how you select the date if you want more/less than a day’s timeframe for deciding to count new views.