I''m new to Rails. I have an application with a group of external links <a href="www.externalsite.com">. I would like to track the first time someone clicks on one of those links in my DB. What is the standard "Rails" way to do something like this? Thank you in advance --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
no standard exists as far as i know. you have 2 options as i see it. 1.) run each link through a redirect. something like: <a href="mysite.com/tracker?url=www.externalsite.com">blah</a> 2.) or use some javascript and implement an onclick handler on the link to fire an ajax request back to your application at work i had to implement something similar, ive used both options successfully, each has its advantages/disadvantages. for example, #2 wont provide tracking if the user disables javascript. On Feb 5, 1:08 pm, Shannon <shannon.ho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m new to Rails. I have an application with a group of external > links <a href="www.externalsite.com">. I would like to track the > first time someone clicks on one of those links in my DB. What is the > standard "Rails" way to do something like this? > Thank you in advance--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
There''s no standard way :) The way I use is to link to an action which retrieves the lonk, adds one to a link counter in the db and does a redirect. Go and try to do that. Come back if you have issues and show your working. Blog: http://random8.zenunit.com/ Learn rails: http://sensei.zenunit.com/ On 06/02/2009, at 6:08 AM, Shannon <shannon.hogue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m new to Rails. I have an application with a group of external > links <a href="www.externalsite.com">. I would like to track the > first time someone clicks on one of those links in my DB. What is the > standard "Rails" way to do something like this? > Thank you in advance > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---