Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The statistics report referrer is trying to remove local referrers by using NOT LIKE '%%%s%%' resulting in removal of statistics from external sources that uses the target in the url. That includes for example facebook and the new google-url standard. Filtering out google seems a bad idea.
Google for example uses "&url=http%3A%2F%2Fwww.exampledomain.com" in the url.
One way to fix this is to change rows 120>> in statistics.admin.inc
$query .= tablesort_sql($header);
$result = pager_query($query, 30, 0, $query_cnt, $_SERVER['HTTP_HOST']);
$rows = array();
to
$query .= tablesort_sql($header);
$server_url = "http://" . $_SERVER['HTTP_HOST'];
$result = pager_query($query, 30, 0, $query_cnt, $server_url);
$rows = array();
Perhaps its not a final solution since the "http://" is accepted in the url even thoug sites like google or facebook dont use them.
Comments
Comment #1
DJ C CreditAttribution: DJ C commentedthis is still true for core 7.10 and very annoying, as it filters a lot of valid referrers like google and many others
I would further suggest to not filter empty referrers as this might be a valuable information for quite some webmasters as well
as quick fix you can, in statistics_top_referrers(), modify to
->condition('url', '%' . $_SERVER['HTTP_HOST'] . '/%', 'NOT LIKE')
and remove
->condition('url', '', '<>')
however this will not fully fix the thing as
a referrer like 'http://referrer.tld/yourdomain.tld/link.html' will still get filtered out
and the empty referrer wont be displayed as empty but as 'admin/reports/referrers'
but its a start ;)