For full API documentation visit the official USERcycle docs at http://docs.usercycle.com/rest_api
Add to Gemfile:
gem 'usercycle', :git => 'git://github.com/usercycle/usercycle-api-ruby.git'
require 'usercycle'
# put your own credentials here
api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
# set up a client to talk to the USERcycle API
@client = Usercycle::Client.new api_key
identity = '[email protected]' #required
@client.event.find_by_identity(identity)
identity = '[email protected]' #required
action = 'signed_up' #required
properties = { :first_name => 'John', :last_name => 'Smith' } #optional
occurred_at = 5.days.ago #optional
@client.event.create(identity, action, properties, occurred_at)
#create
will return false if there was a communication error. If it's
critical this data get into USERcycle, you should retry the operation.
@client.event.get(uuid)
Coming soon.
Cohorts are used to group your users and track their actions over time. There are 3 types of cohort intervals - daily, weekly, and monthly.
Returns the last four sets of cohort metrics from the specified starting date. You can override the count by passing an optional second parameter.
We will automatically adjust passed dates to conform to the API requirements for weekly (date must be a Monday) and monthly (date must be the 1st of the month).
@client.cohort.stats.get_daily(start_date, [count])
@client.cohort.stats.get_weekly(start_date, [count])
@client.cohort.stats.get_monthly(start_date, [count])
You can also retrieve a list of users who belong to a cohort according to one of the following macros:
- AARRR (default)
- activated
- retained
- trial
- billed
@client.cohort.people.get_daily(start_date, [macro])
@client.cohort.people.get_weekly(start_date, [macro])
@client.cohort.people.get_monthly(start_date [macro])
usercycle-api-ruby is licensed under the 3-clause BSD license, see LICENSE file for details.