Sha256: 4703957f6f64f7c1719b481efb6af551d3f16b7ec1f924048076a8554a7727d3

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

= IntercomRails

Rails helper for creating Intercom (https://www.intercom.io) javascript tags.

For interacting with the Intercom API, use the intercom gem (https://github.com/intercom/intercom-ruby)

== Installation
Add this to your Gemfile:

  gem "intercom-rails"

Then run:

<code>bundle install</code>

== Usage

Take note of your app_id from here: You can find your app id here: https://www.intercom.io/apps/api_keys

=== rails generator

The <strong>intercom:install</strong> rails generator will add <code>intercom_script_tag</code> to your application layout. It provides a great start that will work well for most people and is easily customised.

<code>rails g intercom:install YOUR-APP-ID</code>

=== manual install

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.

== Contributors

- Dr Nic Williams (@drnic) - provided a rails generator for adding the Intercom javascript tag into your layout.

== License

This project rocks and uses MIT-LICENSE.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
intercom-rails-0.0.4 README.rdoc
intercom-rails-0.0.3 README.rdoc