Devise::Acquirable
This project started as a fork of nate's n8/devise_marketable project.
Acquirable lets Devise implementers easily store where a user came from and where they were going in your Rails app.
With Acquirable, Devise will automatically create two cookies for your users when they first visit your app, the referring_url (where they came from) and the landing_url (where they landed). When the user registers with your application, the values in those cookies are stored alongside your user data.
Installation
- Add 'devise-acquirable' to your Gemfile.
gem 'devise-acquirable'
- Run
bundle install
- Add the marketing fields to your user table:
rails g devise-acquirable MODEL
MODEL is probably User
. It's what you attach Devise to. (e.g. User, Admin, Account)
rails g devise-acquirable User
- Run your migration
bundle exec rails db:migrate
- Check
:acquirable
was added to thedevise
call in your model by thedevise:acquirable
generator
devise :database_authenticatable, ..., :acquirable
- Restart your server
That's it. You now have some very powerful data: where your best customers come from, what traffic sources are your most lucrative, what on your website converts the best, what people are most interested in, etc.
Feedback
Source code available on Github. Feedback and pull requests are greatly appreciated.