Extra explicationsWhen coding this module, and after several test on various sites, I had to decisions which may not suits every users. Here are some of them:
1)
Keywords selectionIn the 'record.php' file, the keyword selection is running through a filter process:
// Keyword analyser //////////////////////////////////////////////////
$array = explode(' ', $query);
foreach ( $array as $query ) {
$query = strip_tags($query);
// Uncomment the following line if you have problems with special characters.
// Attention: this option may cause your site to crash if not accepted by your server!
// $query = mb_convert_encoding($query, "", "auto");
// Check keyword lenght
$query_lenght = strlen($query);
if ( $query_lenght > $min AND $query_lenght < $max ) {
// if you want to remove puncutation except the '.'
$query = str_replace('.', 'xzy', $query);
$query = eregi_replace("[[:punct:]]"," ", $query);
$query = str_replace('xzy', '.', $query);
// if you want numbers
// $query = eregi_replace("[[:digit:]]"," ", $query);
// All charaters minuscules and remove blank spaces
$query = strtolower($query);
$query = trim($query);
// End Keyword analyser //////////////////////////////////////////////
Minimu and maximum keyword size is set in the head of the file.
2)
Targeted page recordsI got a long discussion wether we should record each and every page targeted by search engine, referers and linked to keywords with Marco. We finally decided not to record all of them, but only to link the latest page visited to the latest query/referer. The main objective of this was to keep control of the database size. Plus, having too much result would lose the webmaster in a data overweight.
3)
Record operationThe 'record.php' file is activated on each and every page of your site. In the hope to limit database queries, the record functions are activated in the following cases :
a. the referers url is different from the current site and not a direct call.
b. if the referer has keywords, it is considered as a search engine, and thus record the used keywords.
c. to check wether the visitor is a bot or not, its useragent must be different from Mozilla and Opera.
Some errors may arise from this control. Please let me know about recurrent errors so I can adapt the code.