OVERVIEW | SETUP | USER GUIDE | DOWNLOAD | TODO | NEWS | FAQ | FORUM | MAILING LIST | SUPPORT


FORUM  

Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
filter referer in overview
Posted by: jochen (---.dip.t-dialin.net)
Date: January 16, 2006 08:31PM

Hi @all!

First I have to say that your statistic tool is best!!

I have a question reffering to the referer. I use ezBOO on every site (with php) and in the statistic overview I can see all the referers. But because of using it on every every site, nearly every site is displayed in the overview (referer). Maybe this just happens because our site is reachable with and without "www".

Is it possible to filter the displayed overview of the referers so that only external sites appear? But I don't want to loose the referers in the rowlogs.

thanks a lot, bye
jochen

Re: filter referer in overview
Posted by: Beloop (Moderator)
Date: January 24, 2006 12:53AM

Hello,

Do you mean that you want to remove both www.yourwebsite.com and yourwebsite.com from the referrer ?

Here is a simple trick:

Remove the function ClassAndCountField() (located from line 357 to 432) in log_func.php and replace it by the following:

function ClassAndCountField($table_log,$field,$reqdate,$period) {
// Global variables for SQL connection
global $server;
global $user;
global $password;
global $base;

// Global variables from config.inc.php
global $sites;

$c = mysql_connect("$server","$user","$password") or die($msgSqlConnectImpossible);
$db = mysql_select_db("$base") or die($msgBaseConnectImpossible);

# initialize result array
$val_array = array("Total"=>0);

# select what to search for depending on selected period
switch ($period) {
case "jour":
if ($field =="referer")
{ // Remove localhost and empty referer
$q_string = "SELECT DISTINCT($field) FROM $table_log
WHERE $field NOT LIKE ('%$sites[$table_log]%')
AND DAYOFYEAR(date)=DAYOFYEAR(FROM_UNIXTIME('$reqdate'))
AND $field!=''
AND $field NOT LIKE 'http://yourwebsite.com%'";
}
else
{
$q_string = "SELECT DISTINCT($field) FROM $table_log
WHERE DAYOFYEAR(date)=DAYOFYEAR(FROM_UNIXTIME('$reqdate'))";
}
$result = mysql_query ($q_string);
while ($row = mysql_fetch_array ($result))
{
$q_string_2 = "SELECT COUNT($field) FROM $table_log WHERE DAYOFYEAR(date)=DAYOFYEAR(FROM_UNIXTIME('$reqdate')) AND $field='$row[$field]'";
$result_2 = mysql_query ($q_string_2);
$total_field = mysql_result ($result_2,0);
$val_array = $val_array + array("$row[$field]"=>$total_field);
$Total=$Total+$total_field;
}
$val_array["Total"] = $Total;
break;

case "semaine":
if ($field =="referer")
{ // Remove localhost and empty referer
$q_string = "SELECT DISTINCT($field) FROM $table_log
WHERE $field NOT LIKE ('%$sites[$table_log]%')
AND WEEK(date)=WEEK(FROM_UNIXTIME('$reqdate'))
AND $field!=''
AND $field NOT LIKE 'http://yourwebsite.com%'";
}
else
{
$q_string = "SELECT DISTINCT($field) FROM $table_log
WHERE WEEK(date)=WEEK(FROM_UNIXTIME('$reqdate'))";
}
$result = mysql_query ($q_string);
while ($row = mysql_fetch_array ($result))
{
$q_string_2 = "SELECT COUNT($field) FROM $table_log WHERE WEEK(date)=WEEK(FROM_UNIXTIME('$reqdate')) AND $field='$row[$field]'";
$result_2 = mysql_query ($q_string_2);
$total_field = mysql_result ($result_2,0);
$val_array = $val_array + array("$row[$field]"=>$total_field);
$Total=$Total+$total_field;
}
$val_array["Total"] = $Total;
break;

case "mois":
if ($field =="referer")
{ // Remove localhost and empty referer
$q_string = "SELECT DISTINCT($field) FROM $table_log
WHERE $field NOT LIKE ('%$sites[$table_log]%')
AND MONTH(date)=MONTH(FROM_UNIXTIME('$reqdate'))
AND $field!=''
AND $field NOT LIKE 'http://yourwebsite.com%'";
}
else
{
$q_string = "SELECT DISTINCT($field) FROM $table_log WHERE MONTH(date)=MONTH(FROM_UNIXTIME('$reqdate'))";
}
$result = mysql_query ($q_string);
while ($row = mysql_fetch_array ($result))
{
$q_string_2 = "SELECT COUNT($field) FROM $table_log WHERE MONTH(date)=MONTH(FROM_UNIXTIME('$reqdate')) AND $field='$row[$field]'";
$result_2 = mysql_query ($q_string_2);
$total_field = mysql_result ($result_2,0);
$val_array = $val_array + array("$row[$field]"=>$total_field);
$Total=$Total+$total_field;
}
$val_array["Total"] = $Total;
break;
}

arsort($val_array);
mysql_free_result ($result);
mysql_close ($c);
return $val_array;
}


Note that there is 3 times "http://yourwebsite.com" is this function that you must replace by the URL you want to remove from your referer.

Let me know if it works for you in order to update the FAQ
Beloop

Re: filter referer in overview
Posted by: jochen (---.dip.t-dialin.net)
Date: February 22, 2006 10:34PM

Hi Beloop!

Thanks for your effort!
Now I have tested your updated function. The result is exactly what we need, but the time to build up the statistic site is acceded from about 3 seconds up to 19. I think that's because every row is now additionally checked for a string starting with the other URL. So I tested a bit on my own and I have found a solution:

In the config.inc.php the page you want to look at is set:
(e.g. $sites = array( "ez_logezboo"=>"www.yourwebsite.com"); )

There you can also define that you want to watch more than one site with an array.
Take two times the same table to log and then define the two types of URL for your Homepage. (e.g. $sites = array( "ez_logezboo"=>"www.yourwebsite.de", "ez_logezboo"=>"yourwebsite.de")winking smiley

So it works! :-) And it's as fast as before (or I can't recognize the difference :-)).

Maybe that helps you for your faq. I have one further question. You told to offer a newer version in future with additional features. How far are you on your roadmap? Maybe I can support you in developing process!?

Best regards,
Jochen



Sorry, only registered users may post in this forum.

Contact