Reputation: 77
I want to store url of user's referral website after sucessfull registration. In this case I can't use request.referer
because user can visit few pages on my website before registration. But I need previous website url, for example http://google.com
or http://facebook.com/somepage_id
or whatever. I know that Google Analytics or Intercome can collect this data but I want something simple. Preferably without external APIs or libraries if this possible.
Upvotes: 3
Views: 1168
Reputation: 670
There is ruby gem called 'ahoy', which can be used for this.
When someone visits your website, Ahoy creates a visit with lots of useful information.
Please find the link for more information, Ahoy
Upvotes: 4
Reputation: 414
When user reach your site create UserSession
which will store request.referer
also it has user_id
. And during registration bind UserSession
to created User
by filling user_id
. In this case you will get site from which user came + you can get some additional info from UserSession
(user-agent, date, visited pages and etc.)
Upvotes: 1