Outbound
A simple interface to integrate with http://outbound.io
Installation
Add this line to your application's Gemfile:
gem 'outbound'
And then execute:
$ bundle
Or install it yourself as:
$ gem install outbound
Usage
Easy and simple to use.
# Create the object
ob = Outbound::API.new("your_api_key")
# identify a user
ob.identify(user_id, traits)
# track a user
ob.track(user_id, event, payload)
Here is an example in sinatra.
require 'sinatra'
require 'outbound'
require 'multi_json'
before "/*" do
@ob ||= Outbound::API.new("your_api_key")
end
post '/identify' do
content_type :json
traits = {
first_name: params[:first_name],
last_name: params[:last_name],
email: params[:email]
}
MultiJson.dump(@ob.identify("SOME_UNIQUE_ID", traits))
end
post '/track' do
content_type :json
payload = {
item: params[:item]
}
MultiJson.dump(@ob.track("SOME_UNIQUE_ID", "purchased an item", payload))
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request