HeatmapRb :construction:

Integrate heatmaps in your web application to see on which part the user spends most time on your web application. Where does users click on the page. Helping in gathering analytics to find out what works on the web, what attracts most of the users. View user interactions and make your application more amazing! :sparkles:

Local Testing

Use

gem 'heatmap-rails', git: 'https://github.com/Qbatch/heatmap-rails.git'

Installation

Add this line to your application's Gemfile:

gem 'heatmap-rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install heatmap-rails

Usage

  1. Install the gem
  2. Run the command to generate migration:

    $ rails g heatmap_rails:install
    
  3. Migrate:

    $ rake db:migrate
    
  4. Include the following helper on any page where you need to generate the heatmap:

    <%= save_heatmap %>
    
  5. Include where to show the heatmap:

    <%= show_heatmap(request.path) %>
    
  6. In respective JS file, Require HeatMap.Js to show the heatmap:

    //= require heatmap.js
    

    Viewing Heat Maps

    Use the helper

    <%= show_heatmap(request.path) %>
    

    The argument is the path of current page. This way the helper will only display the respective heatmap. The viewing can be done in multiple ways, for example if you want only the admin users to view heatmap, you can do something like:

<% if admin_user_signed_in? %>
    <%= show_heatmap(request.path) %>
<% end %>

Another way can be using some code in URL. For example is you want to use URL like

www.website.com/see_heatmap

You can use:

<% if request.path.include?("see_heatmap") %>
    <%= show_heatmap(request.path) %>
<% end %>

And there can be multiple ways!

Options

You can customize:

<%= save_heatmap({click: 3, move: 50}) %>

These are default values.

Development :construction:

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Credits

heatmap-rails uses HeatMap.Js to generated show heatmaps.

Contributing :construction:

  1. Bug reports are always welcome.
  2. Pull Requests. Suggest or Update.

License :construction:

The gem is available as open source under the terms of the MIT License.