PersistCampaign
Persist campaign parameters - such as utm_campaign, utm_source, etc - on Rails redirect_to.
Installation
Add this line to your application's Gemfile:
gem 'persist_campaign'
And then execute:
$ bundle
Default persisted keys
- utm_campaign
- utm_source
- utm_medium
- utm_content
- utm_term
- gclid (for Google Adwords)
Configure additional keys
You can append to the key array in a configuration block. There is an install generator to create the initializer file.
rails g persist_campaign:install
Edit the initializer to append other keys:
PersistCampaign.configure do |config|
config.keys += ['foo']
end
Testing
rake
Credits
Thanks to ndp's save-the-campaign gem for providing the solution to patching Rail's redirect_to implemention. His solution is reproduced here under the MIT license.
Contributing
- Fork it ( http://github.com/mubi/persist_campaign/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request