I know it's too much to ask but will try my chance.

is it possible to add a "this link has been visited x times" feature to this module ?

CommentFileSizeAuthor
#9 count_clicks.patch8.53 KBdimon4ikzp
#6 clicks_count.patch8.7 KBdimon4ikzp
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iori57’s picture

I would like to have this features as well :)

goldlilys’s picture

This feature would be nice to have. Actually shouldn't it be basic since people would like to know how many times a link has been clicked or have a conditional for it. The number of times it has been clicked can be enabled for each node type and can choose where to place the counter. Should it be to the right or left of the link title, etc .

Also have the ability to use the click count in views for popularity as an example.

Vako’s picture

Enable the statistics module in core and set the properties.
Then download and install the count module.

Elvys’s picture

Hi, I'm new to Drupal. Could you be more specific?
Thanks!

W.M.’s picture

Version: 6.x-2.8 » 7.x-1.0-alpha3

I want to ask whether the Drupal 7 version supports the above mentioned feature ?! I think this would be a great addon for this module.

dimon4ikzp’s picture

Version: 7.x-1.0-alpha3 » 7.x-1.0
Status: Active » Needs review
FileSize
8.7 KB

here is the patch which add this feature to the latest version 7.x-1.0.
please, review it and give your feedback.
thanks

jcfiala’s picture

Status: Needs review » Needs work

Hey dimon4ikzp!

You've definately got the basics down for what the module needs to do, but there's a couple of problems that come to mind:

1) What i the link field is a multi-value one, or what if there's two link fields on the same entity? Then the code won't know which link to increment, or may increment the wrong one.

2) What if we've got two entities with a link field that may have a vid? Then the code won't know which entity to use.

3) What if the entity you add a link to doesn't have a vid? Users, for instance, don't.

One possibility would be to expand the link_goto to be something like 'link_goto////' It's long, but it's fairly comprehensive. So, for a node you might have 'link_goto/node/548/field_favorite_link/0', for instance. Again, a bit of a pain, but the user's not supposed to see it for very long.

Also, it might be cool to also have an option for a javascript counter for folks who have javascript, so that the link can be the normal link and the javascript calls the link_goto path invisibly. That might be better for your SEO.

But it's a good start, honestly.

dqd’s picture

dimon4ikzp, thanks for the contribution. I agree with jcfiala, this is really an awesome start. But please try to diff/patch always against latest --dev so we can be sure that it keeps in line with other solved issues and development which is already in the repo and changes line numbers and so on ...

thanks 4 all the effort, much appreciated!

dimon4ikzp’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Needs work » Needs review
FileSize
8.53 KB

Hi
All you suggestions have been implemented excluding javascript functionality. Hope all is well.
Please give your feedback, thanks

fiveaces’s picture

Version: 7.x-1.x-dev » 7.x-1.0

Hi,
Firstly I would like to thank the people who put this great module together.
Thanks also to dimon4ikzp for patch #9. I applied the patch to version 7.x-1.0 and it works great with no errors.
I was wondering if it would be possible to extend this functionality further and have the link count filtering on user IP address over a time period so that a users will not be able to register a click count numerous times in a row. What I suggest is having a time limit on the Link creation page allowing custom time periods; 2 hours, 1 day etc. for click per IP address.

This would be a beneficial feature as it would log more realistic statistics for Site administrators.

Keep up the good work.
Many thanks

dqd’s picture

Version: 7.x-1.0 » 7.x-1.x-dev

dimon4ikzp++

thx for the patch!

fiveaces please don't change the version for the issue, if there is patch already provided for another version agreed with others. But thanks for your report and contribution. Please repeat you report on latest --dev and let us know.

@others: Patch needs more reviews. Please give feedback so that I can commit it asap.

fiveaces’s picture

Digidog,
I apologize for changing the version in my comment.
To make up for it, I tested #9 on the 7.x-1x-dev version. It cleanly applied and installed without any errors.
Please consider my previous suggestion. Thanks

berdyshev’s picture

Status: Needs review » Reviewed & tested by the community

thanks, dimon4ikzp. it works great for me.

dqd’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

review fails:

First:

after refreshing cache

    Notice: Undefined property: stdClass::$field_link_test_count in field_sql_storage_field_storage_load() (line 360 of /home/digidog/www/digidog/modules/field/modules/field_sql_storage/field_sql_storage.module).
    Notice: Undefined property: stdClass::$field_link_test_count in field_sql_storage_field_storage_load() (line 360 of /home/digidog/www/digidog/modules/field/modules/field_sql_storage/field_sql_storage.module).

is thrown out ...
recalling the page without another cache clear, the Notice disappears, but after pressing a link, site breaks with this error message
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_link_test_count' in 'field list': UPDATE {field_data_field_link_test} SET field_link_test_count=field_link_test_count + 1 WHERE (entity_type = :db_condition_placeholder_0) AND (revision_id = :db_condition_placeholder_1) AND (entity_id = :db_condition_placeholder_2) AND (delta = :db_condition_placeholder_3) ; Array ( [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] => 113 [:db_condition_placeholder_2] => 78 [:db_condition_placeholder_3] => 0 ) in link_goto_url() (line 1250 of /home/digidog/www/digidog/sites/all/modules/link/link.module).
Only after deleteing link field on content-type and re-inserting link field, the errors disappear. This is not good for a usual commit or push since it would break existing sites with existing link fields. If we sty on this concept, it would need other ways around to keep old link fields untouched. Were we come to my next, last and maybe most hurting point here:

Second:

Using a widget selector to switch to "Quantity of clicks" which shows nothing than a number and without any warning that it removes the entered link from before, is not good nor I see the use of having just a number on the page without the ability to click on anything. Switching back to another widget turns out a link like this http://digidog.pc/link_goto/node/78_113/field_link_test/0 and there is no chance to turn it back to the old value. I don't really understand what this behaviour is good for ...

Summary: In the moment I would rather suggest something like this http://drupal.org/project/pop_links to use or would like to see another way to go for this than the solution provided in this issue here. Sorry, I think this is the wrong road ...

Feel free to refresh the issue if you have any other ideas to solve it. Otherwise I will come back on this later for some ideas when I finished the other issues in my queue ...

dqd’s picture

Status: Closed (won't fix) » Needs work
Encarte’s picture

The Links Package module has the click counting feature implemented at least since 2006. And it's working even though the module is more or less abandoned. How does it do it?

dqd’s picture

thanks for info! I will take a look on how it works there ...

krembo’s picture

Hi, everyone. What is the solution for 6.x Link version?

grey_’s picture

+1 For this feature also in the 6.x version.

Sorry, cant help with a patch.

sa3er’s picture

jenlampton’s picture

Issue summary: View changes

See also https://www.drupal.org/project/link_click_count for link field values.

dqd’s picture

Title: click counting » Support for click counting
Status: Needs work » Closed (outdated)

Thanks for the link to the module providing this feature, @jen!

Aprt from that: Thanks for the reports and all the efforts in here. But due to inactivity in this issue for some years and because of the upcoming EOL of Drupal 7, I will close this issue on the way by cleaning up the issue queue.

Feel free to re-open as "Needs review" if you found a solution or have a patch to be reported to help others on this outdated version.

If you think this issue or missing feature should be addressed in a newer Drupal core 8 and above compatible version of this project, then please file a new issue to the latest dev.

DamienMcKenna’s picture

Status: Closed (outdated) » Closed (won't fix)

Thanks for spotting this.

I'd like to further state that this module is not the correct tool for data logging, use a separate analytics tool if you want to do that.