Rails helper for creating Intercom (www.intercom.io) javascript tags.
For interacting with the Intercom API, use the intercom gem (github.com/intercom/intercom-ruby)
Add this to your Gemfile:
gem "intercom-rails"
Then run:
bundle install
Take note of your app_id from here: You can find your app id here: www.intercom.io/apps/api_keys
The <strong>intercom:install</strong> rails generator will add intercom_script_tag
to your application layout. It provides a great start that will work well for most people and is easily customised.
rails g intercom:install YOUR-APP-ID
In your layout file:
<% if logged_in? %> <%= intercom_script_tag({ :app_id => 'your-app-id' :user_id => current_user.id :email => current_user.email :name => current_user.name :created_at => current_user.created_at :custom_data => { }}) %> <% end %>
:custom_data allows you to specify any app/user/situational data to associate with the current_user. It will be visible in Intercom, and you’ll be able to search/filter/send messages based on it.
e.g.
:plan => "Pro", :dashboard_page => 'http://dashboard.example.com/user-id'
See {IntercomRails::ScriptTagHelper} for more details.
-
Dr Nic Williams (@drnic) - provided a rails generator for adding the Intercom javascript tag into your layout.
This project rocks and uses MIT-LICENSE.