Handling Advanced Customer Behavior Triggers with Customer.io

As a Mandrill support analyst, I get a lot of questions from users looking for quick and easy ways to send triggered emails based on a customer’s interaction with their application or site. For example, they may want to send a series of onboarding emails to new customers to help them get the most out of important features by including tips, tricks, or tutorials. Our webhooks are a powerful way to get the data needed to trigger these types of interaction-specific emails, but they’re only one piece of the puzzle. It’s still necessary to create the logic to handle those triggers, and that’s not always feasible for smaller teams or for those who don’t have the development resources to set up and maintain that kind of advanced logic.

Meet Customer.io

Customer.io makes it easy to track detailed customer behavior and send triggered emails tailored for your customers, without needing a custom-coded solution. Best of all, you can use Customer.io’s triggers and segmenting tools while still taking advantage of Mandrill’s fast and reliable email delivery engine and our advanced reports and analytics.

Customer.io integrates with your site, app, or project so you can quickly and easily identify your users and track the activity that matters most to you and your business. Then, you can send automated, triggered campaigns based on your user’s activity (or inactivity), and even send newsletters to groups or segments of your users based on that same data. And with their JavaScript integration that’s as simple as adding a snippet of code to your app or website, you can start tracking user activity in minutes.

Connect Customer.io to Mandrill

Once you sign up for a new Customer.io account, you’ll need to configure your account to start sending email with Mandrill. (We suggest creating a new Mandrill API Key specifically for your Customer.io integration.) Customer.io offers a quick setup guide to help you get started, and includes all of the details you’ll need to create new webhooks in Mandrill to pass data to your Customer.io account.

Create a triggered campaign in Customer.io

Now that you’re connected to Mandrill and passing user data to Customer.io, it’s time to create your first triggered campaign. As an example, we’re going to send a getting started tutorial to new signups on our WordPress site who haven’t visited our help docs.

Before getting started, we need to add the Customer.io JavaScript snippet to our WordPress theme’s footer (via the footer.php file). For our needs, in addition to the general snippet that connects our site to Customer.io, we’re also including snippets to identify our users to Customer.io and track custom events like when a recipient clicks a specific button on a page or when they purchase something:

WordPress Theme Editor

Next we need to create segments in Customer.io. With Customer.io, you can create segments based on page views, events (like clicks on a button or a successful purchase), user attributes (such as name, user-type, paid status, etc.) or email activity. For our example, we’re going to create a segment that targets new signups in the last week who haven’t viewed our help documentation:

Customer.io segments example

Now that our segment is ready, we can create a campaign based on our saved segment. Since we’re targeting a very specific subset of our users (those who signed up in the last 7 days but haven’t viewed our help docs), we’re going to create a Segment Triggered email campaign. We’re also going to set up a conversion so we can track when these new users visit our knowledge base:

Customer.io conversion settings

Once we’ve targeted our recipients and created our conversion, we’ll create and design the email we’ll actually send to this segment, test it, and then set it to send automatically.

Now that our campaign is sending automatically, we can sit back and view the results!

View reports in Mandrill

Once you start sending triggered Customer.io emails with Mandrill, you can view details about those emails right in your Mandrill account. For example, you can see not only who has opened and clicked, but also view detailed geolocation and demographic information, and even the full delivery details for the message so you always know whether your emails are reaching your customers as expected.

Mandrill demographics page

Other tips and tricks

Using Mandrill’s unsubscribe method

Mandrill’s one-click unsubscribe option makes it easy to ensure that your unsubscribe requests are honored. It also means you can keep your branding intact by creating a custom unsubscribe page with a tailored message for your for users. You can also sync unsubscribes back to your main database using Mandrill’s webhooks.

To use Mandrill’s unsubscribe link, include it in your Customer.io email template just as you would in Mandrill, but with class="untracked" in the anchor tag.

For example:

<a href="*|UNSUB:http://mywebsite.com/unsub|*" class="untracked">Unsubscribe.</a>

Record enhanced message data to your existing systems with Mandrill’s webhooks.

Customer.io will track the data you need for your automations, but you may want to keep additional data in your main database such as complete bounce responses for data cleansing, deferral notices, or other information about the messages that have been sent. In addition to viewing opens, clicks, and deliverability stats for sent emails in the Mandrill web interface, you can also set up webhooks to get details about those events and more right in your application as they occur. For example, you may want to set up webhooks to track when a recipient email bounces, is marked as spam, or when someone unsubscribes so you can keep your list or database in sync with Mandrill. You can create an unlimited number of webhooks, and can have separate webhooks for different websites or environments.

Tutorials from Customer.io

Customer.io offers a ton of extra examples and tutorials to help you get started. We especially like their video that walks you through setting up and sending a welcome email.

And that’s it! This is just a quick overview of how you can use Customer.io and Mandrill to get more out of your automated emails, but if you have other tips, tricks, or experiences you’d like to share, we’d love to hear them.