Heap Helpers for Ruby
This Ruby gem contains helpers for embedding the heap.js snippet used to instal Heap on a site.
Prerequisites
This gem is tested on Ruby 1.8.7 and above, and is expected to work with Rails 2.3.8 and above. The gem depends on the official heap gem.
Installation
If you're using bundler, add the following line to your Gemfile.
gem 'heap-helpers'
Otherwise, install the heap-helpers gem and activate it in your code manually.
gem install heap
require 'heap-helpers'
Setup
Follow the instructions for the heap
gem.
Usage
Add the following in your layouts or views, before the closing </head>
tag.
In a typical Ruby on Rails application, this change would go into
app/views/layouts/application.html.erb
.
<%= Heap.javascript_tag %>
The helper supports advanced heap.js options.
<%= Heap.javascript_tag force_ssl: true %>
You can also specify advanced options in the initialization code. This is especially useful if you're using the same helper in multiple places in your code.
Heap.app_id = 'YOUR_APP_ID'
Heap.js_options = { force_ssl: true }
Copyright
Copyright (c) 2016 Victor Costan, released under the MIT license.