Couple very minor changes to the display of the stats for Top Referrers page. First, many users will want to see which referrers are the most popular and leave it at that. However, it is more useful to see who has been most recently sent to your site and how often referrers have forwarded people your way.

Next (and most importantly) a 35 character limit is great for display, but if you want to know which search string from google is sending you hits, you need to be able to see the full url. Title makes that trivial.

--- /tmp/statistics.module 2007-04-05 17:20:07.000000000 -0400
+++ statistics/statistics.module 2007-04-05 17:24:10.000000000 -0400
@@ -344,7 +344,7 @@
$header = array(
array('data' => t('Hits'), 'field' => 'hits', 'sort' => 'desc'),
array('data' => t('Url'), 'field' => 'url'),
- array('data' => t('Last visit'), 'field' => 'last'),
+ array('data' => t('Last visit'), 'field' => 'last', 'sort' => 'desc'),
);

$query .= tablesort_sql($header);
@@ -513,7 +513,7 @@
function _statistics_link($path, $width = 35) {
$title = drupal_get_path_alias($path);
$title = truncate_utf8($title, $width, FALSE, TRUE);
- return l($title, $path);
+ return l($title, $path, array('title' => $path));
}

function _statistics_format_item($title, $path) {

CommentFileSizeAuthor
#6 top_referrers_0.txt1.95 KBmgifford
#5 top_referrers.txt977 bytesmgifford

Comments

bdragon’s picture

Version: 5.1 » 6.x-dev
Status: Needs review » Active

New features go against HEAD. Patches need to be attached to be easily reviewed.

Thanks.

mgifford’s picture

I believe it was submitted against head a while back.. head changed though.. How's this..

--- statistics.module.old 2007-07-02 13:09:48.000000000 -0400
+++ statistics.module 2007-07-02 13:09:21.000000000 -0400
@@ -338,7 +338,7 @@
$header = array(
array('data' => t('Hits'), 'field' => 'hits', 'sort' => 'desc'),
array('data' => t('Url'), 'field' => 'url'),
- array('data' => t('Last visit'), 'field' => 'last'),
+ array('data' => t('Last visit'), 'field' => 'last', 'sort' => 'desc'),
);

$query .= tablesort_sql($header);
@@ -509,7 +509,7 @@
function _statistics_link($path, $width = 35) {
$title = drupal_get_path_alias($path);
$title = truncate_utf8($title, $width, FALSE, TRUE);
- return l($title, $path);
+ return l($title, $path, array('title' => $path));
}

function _statistics_format_item($title, $path) {

cburschka’s picture

"Attach" means you save the patch as a text file and upload it using the "File attachment" form below the post. Please don't paste it in the post, as it firstly clutters the page and secondly will get filtered by both Drupal (removing HTML tags and what may look like one) and your browser (removing extra whitespace) so it is highly unlikely to still match if you try to copy and apply it.

gábor hojtsy’s picture

Category: bug » feature
Status: Active » Needs work

How come you think that adding two default ordering arguments would work? The idea behind sorting by number of hits is that this page is a 'top referrers page', so the top ones are on the top basically. The sorting API works by sorting by one column at a time.

The nature of this patch would move the page away from being a top referrers listing, so it is a feature request, not a bug report. Let's at least discuss this some more, whether this makes sense usability-wise, while all other pages are "top something" in the stats module output.

mgifford’s picture

StatusFileSize
new977 bytes

Arancaytar, I've copied the code into a file that I have now attached. People do this both ways though and for the two line change I was proposing it seemed like it wasn't worth the bother of attaching a file. I can try to attach files more in the future though.

Gábor, the patch has been working for me but the default display doesn't order them by who has sent the most people to your site. I do think that it is much more useful for people to track who is sending people to your site in the last day or so than it is to know that the top referrer has now sent 4030 hits your way (where as maybe the last time you looked at it there were only 4002). When ordered by number of hits it is hard to learn what new is happening to your site. It is useful to see the count on each referrer by default, but for people who are actively watching where there links are coming from this display isn't all that useful.

True about the two sort orders, I guess the one I added trumped the one that was there. I revised my patch.

The naming thing is a bit of an issue though as people would probably expect the top referrers to be ordered by the count. However, how often do you presently check the top referrers? Would you check recent referrers more often? Does it need to be something that the user can configure themselves?

I thought I added this as a feature request, but that was quite some time ago now so not sure.

And yes, would totally like some more feedback from both usability folks and seo folks.

mgifford’s picture

StatusFileSize
new1.95 KB

Oh yeah, for usability, might be useful to modify the menu entry too then so that Recent referrers gets added to the list of other recent logs (Recent log entries, Recent hits & Recent keywords).

The patch is starting to get longer, sorry..

Anyways, this will make the default behavior easier for people who want to keep an eye on recent referral information, but also allow people to easily change the sort order to search by top counts too.

Mike

dave reid’s picture

Version: 6.x-dev » 7.x-dev

Let's split out the two additions here. Adding the title attribute I would easily RTBC, but changing top referrers to recent referrers warrants more discussion.

dave reid’s picture

dave reid’s picture

Title: Simple Usability Enhancements for Top Referrers » Change 'Top referrers' report to 'Recent referrers'
jhodgdon’s picture

jhodgdon’s picture

truncate_utf8() is being fixed, so ignore #10.

jhodgdon’s picture

Issue tags: +String freeze

tagging

mgifford’s picture

Version: 7.x-dev » 8.x-dev

Pushing forward to D8

Laurareid’s picture

i want to implement something similar on my site http://iopenat.com

I am a little worried though that it might result in a lot of spam. has anyone had any issues at all?

jhodgdon’s picture

Laurareid:

This is a Drupal core feature request... It looks like you need some Drupal support. Please do not take existing issues and ask Drupal support questions on them. Instead, there are several support options listed if you click on "Support" at the top of Drupal.org, which will take you to:
http://drupal.org/support

There you can find out about the Drupal IRC channels, and the Forums, which are our two main support mechanisms in the Drupal community.

Good luck with getting your question answered.

mgifford’s picture

Issue summary: View changes
Status: Needs work » Closed (cannot reproduce)

I think this code isn't in Core any more.