How do I track the clicks to an external url?
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 😊
Two options that come to mind are:
- 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)
- Use Javascript to record the event on click (you could use Google Analytics, Mixpanel, Ahoy, etc)