Rack-search_terms is a project mainly written in Ruby, based on the MIT license.
Rack Middleware to extract search terms from the referring search engine
Rack::SearchTerms gives your app access to the search terms that drove the visitor to your site. Simply grab env['search_terms']
in your Rack app and you're away!
Add to your Gemfile:
gem 'rack-search_terms'
In config/environment.rb, add:
config.middleware.use "Rack::SearchTerms"
Just use Rack::SearchTerms
as any other middleware.
Our use case for this is to help our 404 page. If someone is referred from a Search Engine to an unknown page (it happens!), then we do a lookup against our internal search engine and hopefully return what the user was looking for.
You could also use it to highlight search terms within your page, but this isn't advised ;)
I encourage you to:
Maintained by Paul Bowsher
Thanks to Bryan Helmkamp for the Quick Start section of this README :)
See MIT-LICENSE.txt in this directory.