Clickmap

Simple clickmap for html content. This gem assumes that you are passing valid HTML content and an array of hashes with the links (regex) to match and the number of clicks

Installation

Add this line to your application's Gemfile:

gem 'clickmap'

And then execute:

$ bundle

Or install it yourself as:

$ gem install clickmap

Usage

  Clickmap.new(html_string, array_of_links[, extras_options])

For example

  html = "<html><head></head><body><a href='www.test.com'>test</a></body></html>"
  array_of_links = [
    { url: /www.test.com/, count: 12 }
  ]
  extras_options = { css_class: 'my_custom_class'}
  puts Clickmap.new(html_string, array_of_links, extras_options).generate
  # <html><head></head><body><a href='www.test.com' data-clickmap-count=12 class="clickmap-link my_custom_class">test</a></body></html>

Contributing

  1. Fork it ( http://github.com//clickmap/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request