Sha256: f83cac4fa5f833ff9934cc0f70bd8606c005863040ab70ad608375cd5f57446c
Contents?: true
Size: 1.8 KB
Versions: 2
Compression:
Stored size: 1.8 KB
Contents
= hit_counter Ruby version of that old 90s chestnut, the web-site hit counter. == How to Install 1. Install the gem. Gemfile: gem 'hit_counter' 2. Add a controller action to your app. controller.rb: def hit_counter return if params[:url].blank? hc = HitCounter.get params[:url] hc.increment send_data hc.image(params[:style]).to_blob, :disposition => 'inline', :filename => "#{hc.hits}.png", :type => :png end routes.rb: get 'hit-counter' => 'webmaster_tools#hit_counter' # technically should be PUT, but GET makes integration simpler 3. Add the hit-counter image tag to your site's HTML: <img alt="Hit Counter" border="0" src="/hit-counter?url=http://cnn.com&style=1" /> == How to Customize the Hit-Counter Image 1. Create a GIF for each of the digits, 0.gif through 9.gif. 2. Add the images to a folder named after your new style in public/images/digits. 3. Add the folder name to HitCounter::STYLES. In your HTML, specify the new style with a params[:style] equal to its index in the array plus one. == Contributing to hit_counter * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it * Fork the project * Start a feature/bugfix branch * Commit and push until you are happy with your contribution * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. == Copyright Copyright (c) 2011 Roderick Monje. See LICENSE.txt for further details.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hit_counter-0.0.1 | README.rdoc |
hit_counter-0.0.0 | README.rdoc |