Skip to content

germanescobar/convertloop-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ConvertLoop Ruby API Client

A Ruby client of the ConvertLoop REST API. You can sign up for a ConvertLoop account at http://convertloop.co.

Installation

Ruby on Rails

1. Install the gem in your Gemfile

gem 'convertloop', '0.1.2'

2. Run bundle install from the command line.

3. Create a file config/initializers/convertloop.rb:

ConvertLoop.configure(
  :app_id => 'your_app_id',
  :api_key => 'your_api_key'
)

Ruby

1. Install the gem

gem install convertloop

2. Configure the ConvertLoop object passing your credentials.

require 'convertloop'

ConvertLoop.configure(
  :app_id => 'your_app_id',
  :api_key => 'your_api_key'
)

You are now ready to start calling the API methods!

Getting Started

Creating or updating a person

You need to pass at least one of the following: pid, user_id or email to identify a user. Use pid when you are updating a guest of your site (you can obtain this value from the cookie dp_pid). Use user_id to match the id of the user in your application.

ConvertLoop.people.create_or_update(email: "german.escobar@convertloop.co", first_name: "German", last_name: "Escobar", plan: "free")

Any key different to pid, user_id, email, first_seen_at, last_seen_at, add_to_segments, and remove_from_segments will be treated as a custom attribute of the person.

You can add or remove people from a segment ussing the  add_to_segments and remove_from_segments keys:

ConvertLoop.people.create_or_update(email: "german.escobar@convertloop.co", add_to_segments: ['Learn Something'], remove_from_segments: ['Lead'])

Logging an event

You can log an event for any person:

ConvertLoop.event_logs.send(name: "Billed", person: { email: "german.escobar@convertloop.co" }, metadata: { credits: 1000 }, ocurred_at: 1.hour.ago)

If you don't specify the ocurred_at key, the current time will be used. You can use the person key to add custom attributes to that person, or add or remove that person to/from segments.

About

A client of the ConvertLoop API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages