This SDK is written in Ruby, and is open source and hosted on github.
Get started in a few quick steps.
You could skip this for now, but you will need an SDK Key and some Feature Gates or Dynamic Configs to use with the SDK in just a minute.
If you are using Bundler, add the gem to your Gemfile from command line:
bundle add statsig --version ">= 0.1.5"
or directly include it in your Gemfile and run bundle install
:
gem "statsig", ">= 0.1.5"
Initialize the SDK using a Server Secret Key from the statsig console:
require 'statsig'
Statsig.initialize('<secret>')
# Now you can check gates, get configs, log events for your users.
# e.g. if you are running a promotion that offers all users with a @statsig.com email a discounted price on your monthly subscription service,
# 1. you can first use check_gate to see if they are eligible
user = StatsigUser.new({'email' => 'jkw@statsig.com'})
if Statsig.check_gate(user, 'has_statsig_email')
# 2. then get the discounted price from dynamic config
price_config = Statsig.get_config(user, 'special_item_prices')
@sub_price = price_config.get('monthly_sub_price')
end
...
# 3. log the conversion event - 'purchase_made' - once they make the purchase
Statsig.log_event(user, 'purchase_made', 1, {'price' => @sub_price})
For more information, see our SDK documentation on github.