Sha256: 90c62b9cf06e15c00745e7ba7b2cbf4dbf4d23a056dd074b9d903366ea676d31

Contents?: true

Size: 1.91 KB

Versions: 3

Compression:

Stored size: 1.91 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'

=== secure mode

Pass in a second argument to intercom_script_tag, a hash containing the secret, like so:

  <% 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
      },
      {:secret => 'your-apps-secret'}
    ) %>
  <% end %>


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

3 entries across 3 versions & 1 rubygems

Version Path
intercom-rails-0.0.7 README.rdoc
intercom-rails-0.0.6 README.rdoc
intercom-rails-0.0.5 README.rdoc