I have in my site a list of links, which are created by views. These are all external links. No i would like to publish an information about how many times a certain links have been clicked. I cant use a regular statistics module, beacause the links are not linket to the node. I tried to use External Link Popularity –module, but this doesnt meet my needs (at least i assume so), beacause this module counts a hits of external links inside the nodes.
I would have this external link hit counter to have a views integration. Is this possible to achieve via some module or script?
To get impression of what i have in my mind, visit: http://www.ampparit.com/
(hit counter value is the last number of every row)
Comments
Probably much better ideas,
Probably much better ideas, but how about instead of a direct external link, they could all link to a custom Drupal page that first records the click, then redirects them to the actual link.
So each link would be http://www.ampparit.com/mypage?redirect=the/url/to/the/site, then mypage would get the redirect value, log to the database, then redirect using drupal_goto().
Just an idea!
Hi and thanks for your reply.
Hi and thanks for your reply. Your idea is interesting and worth of trying.
I format my external links vith views:
Title -> Output this field as a link -> Link path = [original_url]
So should i just format is as: [node_url]?redirect=[original_url] …for redirecting to work, or do i need some script or else in the node?
I'd create a page using
I'd create a page using hook_menu() in a module, but if you don't want to do that, you can create a node, but then use hook_init() for your scripts.
For example, if you created a node with node id 2, you could use node/2?redirect=[original_url] (though it would look neater with a url alias rather than node/2), then the code inside hook_init() would look something like...
This is just what I'd do, someone might come up with a better idea, but this should work.
Nice! Thank You for the
Nice! Thank You for the answer. I´ll try what You suggested!
ShURLy
I spent some hours to search an answer for this question but got no luck. Finally, I got my solution as follow:
1. Install ShURLy module: http://drupal.org/project/shurly
2. create short URLs you want to count one by one: http://yoursite/shurly
3. replace target URLs with short URLs
4. Check the counter on page of 'admin/build/shurly'
The solution is similar to "redirect" solutions. The advantage is that we don't need to write our code. The drawback is that we need to rewrite the URLs which we want to track one by one.
Cameron Wong
http://www.eguidedog.net