简体   繁体   中英

Rails track user clicks if link to another website

I want to track user clicks on the link, the difficulty is I want to track only external link clicks, for example if my site is www.railssite.com and I have to links www.railssite.com and www.google.com. I want to track only the google.com clicks. how to do this?

You have several ways to do that.

  1. You can use 3rd tracking service eg Google Analytics
  2. Write it your self a custom controller that help you track user clicks, but in this way you will have to change your external link to something like this: http://YOUR_WEBSITE/redirect_to=http://google.com . Then your controller will count the clicks of users of any website of your choice before redirect user to external website.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM