Using Customer.io with Rails
This tutorial will walk you through getting set up with Customer.io on a standard Rails application and getting people to show up in the campaign
--SAMPLE-- Welcome campaign behavioral campaign.
Add the customer.io gem to your
bundle install to install the gem then we’ll set up the configuration.
We’ll add your Customer.io Site ID and API Key. We can do this in an initializer to save time and make sure we don’t accidentally commit sensitive data into source control.
Identify People to Customer.io
Above we created the variable
$customerio in an initializer. We can now use that in our app to pass data to Customer.io.
Let’s identify people when they get created. Add a code snippet like this in your registrations controller:
We’re using instance variables like @email defined in the controller.
created_at is a very important attribute for Customer.io. To see people match the “Welcome” campaign they must have signed up within the past 24 hours.
Create a new user
If you now go back to your application and create a new user, you will see them queued up and ready to send in Customer.io
Deploying to Heroku
Stripe’s amazing guide for Using Stripe’s Checkout and Rails inspired the creation and structure of this guide