Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I track the clicks to an external url?

Amanda asked in Rails

I have a link_to do block that links to an external URL and I would like to keep track of how many times the link was clicked. What would be the best way to do this?

Thanks 😊

Reply

Two options that come to mind are:

  1. Have the link go through your Rails app, track the click, and then redirect to the URL (also get to hide the URL this way)
  2. Use Javascript to record the event on click (you could use Google Analytics, Mixpanel, Ahoy, etc)
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.