Home > rack-search_terms

rack-search_terms

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

  • Repository: http://github.com/boffbowsh/rack-search_terms

Description

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!

Rails 3 Quick Start

Add to your Gemfile:

gem 'rack-search_terms'

In config/environment.rb, add:

config.middleware.use "Rack::SearchTerms"

Using with non-Rails Rack apps

Just use Rack::SearchTerms as any other middleware.

Use Cases

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 ;)

Contributing to Rack::SearchTerms

I encourage you to:

  • Fork the project.
  • Make your feature addition, bug fix, or support for additional search engine.
  • Add specs for it.
  • Send me a pull request. Bonus points for topic branches.

Author

Maintained by Paul Bowsher

Thanks

Thanks to Bryan Helmkamp for the Quick Start section of this README :)

License

See MIT-LICENSE.txt in this directory.

Previous:grok-examples