Hi, thanks for this great module!

I was wondering is it possible to increment a counter every time a redirect link is clicked?
Thanks!

Comments

tobiass’s picture

A counter would be very useful and informative. I wonder, that no one else would like to have this feature.

+1 for this idea

dave reid’s picture

Version: 5.x-1.2 » 6.x-1.x-dev
Status: Active » Postponed

New features should be made for the current version. Someone write a patch if you want the feature, otherwise I'm leaving this postponed.

nekobul’s picture

Version: 6.x-1.x-dev » 5.x-1.2
Status: Postponed » Needs review
StatusFileSize
new5.02 KB

I have implemented redirect counter support. Find attached the patch for 5.x-1.2 version.

dave reid’s picture

Version: 5.x-1.2 » 6.x-1.x-dev
Status: Needs review » Postponed

5.x is closed for feature requests

hedac’s picture

can this be implemented in 6.x?

hedac’s picture

Status: Postponed » Needs work
StatusFileSize
new921 bytes
new858 bytes

ok this is my first patch for 6.x-1.x dev
but you have to manually create the counter field in the database. int(10)
so far it seems to work
sorry if the patch are wrong.

hedac’s picture

can someone help how to patch #6 the module so it can add the database changes when running in update.php ? I don't have a lot of drupal programming experience yet. It only has to add an Int field named counter.

hedac’s picture

StatusFileSize
new2.88 KB

I think I have done the Git patch correctly.
This is for latest 1.x dev
Adds counter field to the database. You must use update.php.
Increments the counter field each time the redirect is used.
Displays counts in the redirect listings.

Please review.

hedac’s picture

Status: Needs work » Needs review
zazinteractive’s picture

I tried it. Seems to work properly

tchronister’s picture

This is cool. Could this same concept lead to further reportage beyond counter, for instance, date, time, unique IP? I currently glean most of the redirect reportage from the core reportage (Top Pages), but it is tedious. I have specific redirects that go to external URLs and I am trying to capture and report back to my team not only how many have passed through the redirect but also individual date/time and IP. Suggestions?

traviscarden’s picture

Status: Needs work » Needs review
StatusFileSize
new4.17 KB

Good work, @hedac. I've made a few small changes:

  1. I moved the SQL query, because where you had it it didn't necessarily get executed on every hit.
  2. I called the new column "Hits" in the admin screen.
  3. I added an automated test (even though HEAD lights up like a Christmas tree right now in my test environment).

@tchronister: For posterity, this might be of interest: #635116: Click tracking.

Title: Counter » Add a hit counter
Status: Needs review » Needs work

The last submitted patch, path_redirect-hit-count-265299-12.patch, failed testing.

traviscarden’s picture

StatusFileSize
new4.15 KB

Oops. Silly mistake.

Status: Needs review » Needs work

The last submitted patch, path_redirect-hit-count-265299-14.patch, failed testing.

traviscarden’s picture

Status: Needs work » Needs review

#8: counter-265299-8.patch queued for re-testing.

traviscarden’s picture

All right, well I don't know what's making my patches fail, because I can't even get HEAD to pass on my test environment, and I don't have time to work that out right now. Let's just call #12 feedback on @hedac's patch for today. Thanks.

prashant.mahabare’s picture

#3: counter.patch queued for re-testing.

stackpr’s picture

Patch in #265299-14: Add a hit counter worked well for me against 6.x-1.x.