Go back to Blog

Growth & Marketing

Jes Kirkwood on November 15th 2021

Shopify's VP, Growth Morgan Brown reveals how the company's growth team drives results in an exclusive interview.

All Growth & Marketing articles

Mike Sharkey on April 17th 2015

Today, a surprising 61% of marketers in the US still rely on basic batch and blast emails to communicate with their audience. Only 4% have “graduated” to marketing automation, or creating email campaigns based on the personal experience each user has in your product.

Marketing automation is appealing because you can collect more granular lifecycle data on how customers move throughout your website, app, landing pages, support portals, etc., which in turn lets you to send more targeted messages.

In this post, I’ll explain how Autopilot and some of our customers use this approach to create relevant, high-converting email campaigns.

What is behavioral marketing? 

Behavioral marketing, also called behavior-based marketing, is a marketing strategy that utilizes data on how customers interact with an app, website, or service to create a personalized marketing experience. Behavioral marketing strategies incorporate data such as browsing history, on-page actions & events, demographics, cookies, and IP data to create segmented user profiles that can be targeted with greater specificity and effectiveness than traditional one-size-fits-all campaigns.

What is behavioral marketing automation? 

Behavioral marketing automation refers to tools and processes that businesses use to automatically target users based on behavioral data. This typically means identifying behavior patterns in your target audience and triggering messages based on customers completing (or not completing) specific events within your app, website, or service. 

Different types of behavioral marketing

Behavioral marketing is an umbrella term that includes many different digital marketing strategies across numerous channels. Here are some of the most popular and effective. 

“Customers also buy”

One of the most common types of behavioral marketing, typically used in ecommerce, is suggested selling. This involves tracking data on a customer’s purchasing behavior and the products they view, and suggesting new products that they’re more likely to be interested in. 

Behavioral retargeting

Retargeting is a behavioral marketing strategy that involves targeting customers with advertisements that show pages or products that they’ve viewed in the past. Similar to suggested selling, this strategy uses data on past behavior to better understand what customers are interested in and provide ads that are more likely to convert. 

Email engagement

In email marketing, marketers often use audience segmentation based on previous engagement to send customized messages that will provide the most relevancy (and ultimately improve click-through rates). 

Demographic targeting

Demographic targeting is a type of marketing segmentation that uses customer data such as age and gender to show advertisements more relevant to that demographic. This type of targeting is often used on social media (where demographic information on users is most readily available).

3 awesome examples of behavior-based marketing automation

Now that we’ve walked through what we mean by behavioral marketing, let’s overview some successful examples we’ve seen of businesses harnessing automation to create more effective marketing campaigns.

1. Activate new users by sharing relevant features and resources

It’s common for marketers to set up a drip of activation emails based on a single customer action. For example, a user signs up for a free trial, and we send a series of educational emails. Or, a user completes a key milestone in the product, and we send a congratulations email.

A typical activation email string based on a single event.

These drip emails can effectively guide first time users, but with a holistic view of the customer journey we can make the emails more helpful. For example, let’s look at how PandaDoc incorporates user behavior to send more personalized emails.

PandaDoc is a startup that offers smart document automation for sales. They offer four distinct features:

  • Document Assembly;

  • Configure, Price, Quote (CPQ);

  • Deal Room; and

  • Workflow Automation.

Before signing up for PandaDoc, users typically browse features, read their blog and compare pricing. These actions give us clues into what features they’ll be most interested in.

To collect this data, Pandadoc creates a Segment track event each time a user signs up, which sends the unified identity of the new user along with previous historical information to Autopilot. This data enables us to create a more tailored welcome email.

Instead of using a single welcome email path, PandaDoc sorts users into tracks with different content based on their behavior history. For example, people who browse blogs and pages about the price quote feature are added to the “Configure Price Quote” Segment. After signing up, they receive a personalized onboarding message about the feature they browsed, resulting in more engagement and conversions.

2. Proactively offer customer support to users who have issues

While it’s easy to use Segment for tracking positive events like signups or goal completions, you can also use Segment to identify negative events, such as a bug in your software or a common behavioral roadblock, so that you can automatically send tips or engagement offers.

For example, at Autopilot we use Segment events to increase retention by identifying negative behaviors and taking immediate action to overcome them. Behaviors we listen for include:

  • Failure to complete mail domain setup;

  • Failed connection to Salesforce CRM due to wrong user permissions;

  • Incomplete trial sign up due to technical or other issues; or

  • User encounters a known product issue or bug.

Below is an example of what happens if you encounter an error when signing up for a free trial:

The Segment Sign Up Error track event allows us to immediately recognize the problem and then send a notification email to our support software (Zendesk), which creates a ticket on behalf of our customer. The customer is also notified immediately (via Autopilot), reassured that help is on the way.

In the example above we were able to retain 88% of all signups that resulted in an error.

3. Help users learn your product with positive reinforcement

Analytics applications like Mixpanel or KISSmetrics allow you to create product activation funnels for Segment track events. These activation funnels visualize the popular features and the obstacles that users encounter as they explore your product.

Using this event data, you can identify stages or moments when you need to send automated communications to help your users advance to the next behavior in the activation funnel.

In our own product, when people add the Autopilot tracking code (which allows them to track online activities and capture contacts from form submissions), we know that their next likely behavior is to track a form on their site. In order to increase the conversion rate from adding the tracking code to tracking their first form, we built a user behavior journey.

The journey listens for the Segment track event to notify us when the user has added the tracking script (trackingCodeAdded).

If true, we update the user’s contact field to note that they have added the tracking script, send an internal notification to our team, and then send a personalized engagement email to the user by first checking to see what other relevant events they have completed.

Have they: a) tracked a form, or b) imported their contact from a spreadsheet? Depending on those, we automatically send an email with tips and links that are specific to their actual usage and stage of the activation funnel.

Using Segment to track the moments when customers engage in your product, then automatically sending resources to help them succeed or reward them for positive behaviors, is a win-win. Users feel more satisfied, and your conversion go up big time.


Being able to personalize your marketing based on how customers use your product or engage with your content is nothing new. Neither is automating your marketing or sending multi-channel messages. But doing so quickly and intuitively, and integrating your various data, product, and engagement systems is often hard to do, slow-going, and costly. That’s why we love using Segment to connect all of our systems like Autopilot, Zendesk, and Mixpanel together seamlessly.

If you’d like to learn how to automate personalized communication based on user behavior, catch the recording of our webinar featuring myself, Diana Smith, Director of Marketing at Segment, plus special guests Serge Barysiu, CTO at PandaDoc, and Lauren Alexander, VP of Marketing at PandaDoc.

Chad Halvorson on April 13th 2015

Marketing automation tools will make your life easier by, ya know, automating things. You don’t have to send a welcome email to every customer or follow up with folks who’re inactive individually. You can automate it. The tricky part is finding the right tool for you with a ridiculous number of options on the market.

At When I Work, we use marketing automation tools for everything from lead generation and conversion to content marketing and analytics. Along the way, we’ve evaluated and used a lot of these platforms. Based on our experience, here’s an overview of popular tools and when they’re most helpful.


Customer.io allows you to send targeted messages to users based on what they’ve done in your product, making your emails more relevant and personalized. They also offer the segmentation, comprehensive reporting, and A/B testing features you need to optimize your email marketing.

Category: Customer Activation and Retention

Use if you: Have a growing SaaS or ecommerce business


Extole is a referral marketing tool that turns your customers into brand evangelists. Extole offers a wide range of advocacy products that help you encourage your current fans to bring in new customers by rewarding them. The software also provides analytics, so you can track the ROI on your campaigns.

Category: Referral and Loyalty Programs

Use if You: Want to develop an ambassador or loyalty program


An all-in-one marketing automation tool, Hubspot helps you attract new leads and turn them into customers. Hubspot features include email automation, landing page creation, analytics, lead scoring, and a built-in customer relationship management (CRM) system.

Category: CRM and Lead Generation

Use if You: Want to start investing more in content marketing


Another great all-in-one solution, Marketo is a strong B2B marketing automation platform. Not only does the software help with your lead management, email marketing, and customer tracking campaigns, Marketo also offers a variety of plans that make it an affordable, viable option for nearly any B2B company.

Category: Lead Generation and Content Marketing

Use if You: Want an all-in-one marketing automation system that plays nice with Salesforce


Whether you run an ecommerce site or a brick-and-mortar store with an online presence, Bronto is for you. Bronto offers marketing automation solutions for following up on shopping cart abandonment, as well as helping you run post-purchase campaigns and connect with ecommerce integrations.

Category: Lead Nurturing and Conversion

Use if You: Have an ecommerce or retail-based business


Making communication with your customers personal and relevant is always a challenge, but it’s even more difficult when you’re trying to automate it. Autosend can help! This program allows you to automatically send email, text, and in-app messages to your customers based on their prior actions on your site. From welcoming new customers to sending reminders to upgrade, Autosend has you covered.

Category: Customer Service and Activation

Use if You: Want to communicate more consistently with prospects and customers


If you’re interested in automating responses to customer behaviors, you might also want to check out Blueshift. Blueshift automates behavior-based messaging across many channels including email, push notifications, Facebook, and display ads. You can use Blueshift’s behavioral segmentation to find groups of users that are 3-10X more likely than the average to perform actions like repeat purchase, activation, or churn. With mulit-channel touch points, Blueshift is a great option for B2C companies.

Category: Segmenting and Multi-channel Messaging

Use if You: Want to target users across email, web, and mobile.


Autopilot is a new marketing automation tool focused on customer journeys. You can easily build a lifecycle marketing campaign with a drag-and-drop interface. They also support email and SMS, and offer a number of guides to help you get started.

Category: Lifecycle Marketing

Use if You: Want a visual interface for designing your campaign


Iterable also offers a clean visual interface for creating campaigns and can handle transactional, promotional, and lifecycle emails. They offer A/B testing for up to 50 variations and auto-implement the winner. Iterable also helps you easily test your messages on different email clients, which can be tricky to get right.

Category: Lead Nurturing and Customer Retention

Use if You: Want a single email platform and with A/B testing front and center


If you want your customers to take action, you’ve got to tell them what to do! Outbound helps you do this automatically through email, mobile push, or SMS. You can use the program to set goals and test messages for users in each step of your funnel, and since Outbound doesn’t require coding, your A/B tests and resulting changes are easy to implement.

Category: Customer Service and Acquisition

Use if You: Want to automate communication with potential customers


As its name implies, Drip is a marketing automation platform that allows you to send information to customers or leads at specific intervals. Drip makes it easy for you to slowly feed your communication to customers, whether you’re teaching a free class or want to follow-up on a marketing campaign.

Category: Email Marketing and Lead Nurturing

Use if You: Want to set up a lead nurture campaign or email course


If you build apps, you’ve got to know whether people like them and how frequently they’re being used. Localytics is an analytics program that’s focused exclusively on mobile, offering demographics, usage, and session information in addition to retargeting and automated messaging systems. With Localytics, you can find users having trouble and automatically message them.

Category: Mobile Analytics and Messaging

Use if You: Want an all-in-one platform for app analytics and messaging


Do you ever wish you could watch your customers interact on your site and talk to them if problems arise? Similar to Localytics for apps, Intercom allows you to analyze customer behavior on your site and communicate with customers 1-to-1 or via automated campaigns. You can guide new users through the onboarding process or streamline your customer support with “conversations”. Considering how important customer service is, finding the right tool for customer success is a worthwhile investment.

Category: Customer Service and Acquisition

Use if You: Want to run support conversations and email automation from a single platform

Choosing a marketing automation tool can be a difficult task since there are so many options out there. Hopefully these descriptions have helped you narrow it down! Once you have a few in mind, I’d suggest using Segment to test them against each other without wasting time or resources on installing each individual tool.

If you’re like us, you might find that you actually need two to get the job done. Right now, we’re currently using Vero and Drip through Segment to cover all of our bases.

Have any other recommendations for marketing automation tools you use and love? Tweet @wheniwork and @segment with your thoughts.

Kelsey Ricard on April 10th 2015

The mobile commerce (m-commerce) space has grown 42 percent annually for the past four years—more people are becoming comfortable spending money on their phones, and more retailers are investing in mobile to woo these small screen shoppers. But as the market grows, so does the competition for thumb space and user retention.

To compete, you need to win over users quickly, and A/B testing can help. We suggest focusing on these three areas of the user experience when you’re getting started with m-commerce experiments:

  1. Onboarding

  2. Activation

  3. Retention


A great first-time user experience is critical for users to adopt your app. It’s so important that at any given time more than 50 percent of Taplytics’ customer experiments are focused on improving onboarding. These experiments might test the content and imagery in the first few screens of an app, or the process of getting a user to submit information. Whatever you choose to experiment on, the goal is the same—help your users experience the magical moment of making a purchase as quickly as possible.

Let’s take Frank & Oak for example. The men’s fashion company sets themselves apart by creating a custom shopping experience tailored to each individual’s interests and behaviors. But to get the personal experience, users need to sign up on Frank & Oak’s app first.

As a result, the Frank & Oak team started their A/B testing initiatives with tweaking the signup flow. They first tried changing the field forms and adding the ability to sign up via Facebook. After the first experiment, they tested to see whether an additional option to login with Google would increase signups. You can see the final variation below.

It turns out, that adding a “connect with Google” button increased mobile signups by 150 percent.

While Frank & Oak saw impressive results from a few simple tests, you may need to go through a few more iterations before you find a winning strategy. Here are a some onboarding tests you can run to help get your users through your sign in process to start browsing items.

  1. Login Funnels

  2. Information Collection

  3. Text and Imagery

  4. Sign up Options


Once your users get through the onboarding process, it’s time to activate them. In commerce, this means getting them to purchase something as quickly as possible. To have a shot, our research shows you’ll need to get them to buy within the first two sessions, or it’s unlikely they will ever come back.

For example, when Karmaloop analyzed their customer activation data they noticed that if a first time user placed an item in their Wish List they were much less likely to complete the purchase compared to if they added an item to their cart. Once Karmaloop identified this trend, they set up an experiment to deemphasize the Wish List button in the UI.

Discouraging users to interact with their Wish List allowed Karmaloop to better capture purchase intent. This simple test drove more activations and increased sales by 35 percent.

What can you learn from their experiment? When you’re looking to improve your customer activation, challenge the status quo. Don’t assume that a current feature is achieving your goals. Instead, test your assumptions and use funnel analytics to help brainstorm ideas.


You pushed customers through onboarding and activation—they bought something! Woot! But you’re not done. The last piece of the puzzle in mobile commerce is retention. How do you turn customers into repeat buyers?

There are many strategies m-commerce companies use to increase retention. One effective strategy is hosting targeted sales on a regular basis. For example, Rue La La keeps a “What’s Hot” section in their app specifically to develop scarcity and drive repeat purchases. Other apps achieve it through targeted notification campaigns, whether via email or push.

In the Rue La La example, they could easily test the effectiveness of the “What’s Hot” section on user retention, by creating an experiment where “What’s Hot” is replaced with another section of the app, or taken out altogether. The team would then analyze if cohorts who saw the section come back and purchase more often. Other ideas for testing retention include:

  1. Last chance section

  2. Trending list

  3. Adding discounts or promos for in-app purchases

  4. Changing photography to make items more appealing

Getting Started

The tests discussed here offer ideas to get you started, but to be successful with A/B testing, you’ll have to continually challenge the norm and make sure your team is invested in listening to the results of A/B tests. Some of the biggest improvements can come from the smallest tweaks or even testing a feature you thought was performing well. Once you find a way to optimize your app, you’ll need help from your team to rally around making the change permanent.

If you are new to A/B testing and want to learn more about A/B testing best practices, and how to create a culture that drives experimentation, check out the Mobile Growth Academy at Taplytics for some helpful tips and tricks.

Kevin Niparko on February 24th 2015

For the first couple years at Segment we solved most of our biggest business problems using regular ol’ gut instinct. Everyone was in constant conversation with our initial customers, so it was okay to use intuition to choose our pricing model or prioritize new features. But as we’ve grown, we needed a more analytical approach. About six months ago we started using SQL for analysis, and that’s completely changed how we answer questions about our business.

Direct access to SQL has made us much faster at answering questions, and more teammates are digging in themselves instead of relying on intuition or being blind to siloed information. There are a number of tools on our platform that have made querying and sharing our data around the company much easier.

This article will show you how we use Segment SQL + Mode to speed up our decision-making. We use Mode to query and build reports that can be run by anyone on the team (even non-technical people!). There are a ton of great SQL tools out there, so make sure you find the right SQL stack for your business case.

The Dark Ages

A few months back we had a ton of questions to answer, but no single repository of data to help us answer them. Our support data lived in Zendesk, payment data in Stripe, production database in Mongo and API usage in Redis. In order to answer anything, we had to write 150+ lines of javascript.

The cumbersome process of pulling these data sources together made it too costly to analyze. Zendesk and Stripe’s out-of-the-box reporting was good, but we really needed to combine data across sources. So although the raw data was available, our teams were essentially still in the data dark ages.

For example, our conversion funnel took weeks to get right, and we were constantly bothering our engineers for changes. For our sales team to function, we wrote a plugin for our chat-bot hermes to generate a .csv file of all of our enterprise clients. Another plugin would tell us how many users were using different integrations on our platform. Here’s the code:

Each one of these one-off programs distracted our engineering teams from building a great product, and blocked product, success, sales, and marketing teams from making decisions as they waited for data.

The SQL Renaissance

When we started building Segment SQL, it was meant to be a data warehouse for our largest customers, who were already loading raw Segment data into Redshift. But during alpha we gave it a spin for ourselves and found that even for companies at our size (25 people at the time), getting our data into SQL was really powerful.

We were already tracking events like this:

And all of a sudden, these events were also available to us in SQL:

For the first time we could see how users went from signing up, to sending in support tickets, to upgrading subscriptions. We were able to visualize sign-up rates for users who read a blog post and submitted a help-desk ticket, or track average time spent on the pricing page. Life was pretty good.

But we still found that running queries and building reports was restricted to a small group of SQL power users.

Those who didn’t know SQL stood in increasingly long bread lines. While some teams were able to query the data they needed, reports remained siloed. We were also wasting time re-creating queries that had been written by other teams, or resolving differences in queries across teams.

Adding Mode to the Stack

Enter Mode. Mode makes it easy to create on-the-fly analysis and share it across the organization. As part of our New Year’s resolutions, many around the office decided to get better at SQL. Mode’s SQL School was an amazing place to start (and our marketing team also recommends Periscope’s SQL for marketers!). Mode even came onsite to give us some hands on training.

With SQL, questions that previously took an engineer a ton of time to answer could now be answered with a simple query. And with Mode, these queries are stored as reports that can be shared and re-run by anyone in the organization with a Mode account.

In a matter of weeks, we went from a handful of reports to over a hundred. And now it wasn’t just a few of us creating them, it was every team: from marketing, to partners, to success, to product. Teams were no longer waiting on engineers to access the data, they were querying and making decisions completely by themselves. And better yet, teams were seeing each other’s queries and building on them to make more powerful ones.

This is our actual Mode feed from the time of writing. I think it gives a good snapshot in just how integral SQL (and sharing queries with Mode) has become to our team!

A Few Favorites

As an analyst at Segment, I’m always interested to see what reports other teams are creating. Every once in a while I’ll troll our team’s new reports page to see what people are learning. Here’s a bunch of my favorites:


Remember the conversion funnel that took us a ton of engineering hours to get? Well, here it is using regular-old SQL! Not only does it save us time, but SQL allows us to do custom funnel analysis that’s tricky to do with out-of-the-box tools. For example, we can easily add caveats to exclude users that received an invite or submitted a support ticket!


We love our product team’s interactive user flow analysis, which let’s you get a feel for how users are spending time in our app. We borrowed this one from the Mode playbook!


This is a snapshot of the number of accounts using each of our integrations, which helps our Partners team prioritize partner outreach and co-marketing. While it looks like a simple-enough bar chart, this report used to take a bunch of engineering hours to produce!


Our success team has done some analysis combining ticket data from Zendesk with things like subscription plans and usage to help understand our gross margin. Above is a peek at our daily ticket volumes by business customers. Our amazing success team will never pass up an opportunity to help a customer, even on the weekends!

SQL + Collaboration = Speed

SQL has helped our teams build, learn and share faster, which is helping us move quicker and make more informed decisions. We’ve found that Mode’s Github-like approach to SQL encourages a ‘build-upon-the-past’ mentality that saves us all – not just the analysts – a ton of time.

If you’re just getting started with SQL or interested in learning more, our partners have a ton of great content to get going. Mode’s SQL playbook is a good jumping off point for some common patterns, or if you’re just getting started with Segment + SQL, our SQL partners JackDBLookerChartio, and Xplenty have some good guides to get you set up!

Justin Zhu on February 10th 2015

Email is the unsung hero of user engagement. While Snapchat and Yo! may be fun and flashy, 77% of consumers still prefer to receive marketing messages via email, and no other channel even comes close.

People use email addresses as an extension of their identity and for daily communication. They also use it for registering for new websites, apps and online stores. No wonder it’s also the marketing channel with the highest ROI!

Email can be used to increase user engagement at every life stage –whether a user is new, regular or dormant. Here are three truly great email strategies.

I’ve learned these from my previous position as a growth engineer at Twitter and from working closely with my current Iterable customers. They are easy to set up with Segment and are highly rewarding, in terms of both ROI and engagement.

Justin Zhu is the CEO of Iterable. Congratulations on your recent funding round!

1. Onboarding Flow

Your Adwords campaigns, SEO efforts and TechCrunch article placement have helped to spread the word about your company. Congratulations, you conquered the “awareness” hurdle and users are lining up for your product!

How do you keep these new users engaged during their early days and convert them into a loyal lifetime user? The key tool is the onboarding email series, which will educate new users and encourage them to complete certain desired actions. To create this workflow, first consider what a user must do in order to “get hooked” on your product.

At Twitter, the necessary user actions include following other prominent Tweeters, downloading the mobile app and finding friends on Twitter to achieve mutual follows.

Subject: Welcome to Twitter, firstName lastName!

This email was sent immediately after sign-up to all users.

Subject: Welcome to Twitter, firstName lastName

This email was sent four days after sign-up to all users.

Subject: firstName lastName, find your friends on Twitter!

This email was sent every 4-7 days after sign-up to all users until they reached a certain number of mutual follows.

Here’s how you would build a sample onboarding email workflow:

  1. Trigger when a Signed Up event is tracked, and send welcome email immediately.

  2. Wait at least day.

  3. Check to see if the first desired action (made a purchase, entered credit card info, uploaded profile pic) has been completed.

  4. If desired action has not been completed, send the first action reminder email. It may also help to add an incentive for performing an action. For example, if you’re trying to encourage a purchase, offering a promo code can help!

  5. If desired action has been completed, move user to the next email in the series.

  6. Repeat steps 3-5 for each desired action.

  7. Remove user from new users list and integrate them into your normal email communications.

Welcome emails have very high engagement rates since right after signup, your app or online store is at the users’ top of mind. Typically, we’re seeing open rates of 30-40% for apps and 20-30% for ecommerce companies.

2. Multi-step Abandoned Cart Campaign

Imagine the last time you shopped online, found a product you liked, and added it to your cart with the full intention of buying. Suddenly, something comes up. Your cat pees on the bed, grandma calls, Justin Bieber releases a new album, and you’re off!

This unfortunate cart abandonment happens all the time. But all that is required to bring shoppers back to complete the purchase is a simple reminder.

According to a MarketingSherpa survey of over 2000 Americans, 51% of people who ever left an item in an online shopping cart find reminder emails helpful with 6% saying they always complete the purchase after receiving the message. Creating a cart reminder email can be done using Segment’s ecommerce API to send cart events.

Starter workflow:

  1. User enters the workflow when the Added Item to Cart event is tracked.

  2. Wait 1-3 hours depending on the average shopping time on your website.

  3. Check if user has completed purchase.

  4. If not, send abandoned cart email with preview of items in cart and link to check out.

####Additional advanced steps:

  1. Wait 24 hours.

  2. Send second email, possibly with a discount offer if cart value exceeds certain amount.

Our ecommerce clients see open rates between 30-50% for their cart abandonment emails, and revenue per email is between $1-$3. Adding the second or third email can be quite effective as Dot & Bo saw a 400x increase in campaign revenue with a two-step abandoned cart workflow.

3. Recurring Re-engagement Campaign

You’ve onboarded the user and reminded them to complete their purchase. Hurray, they bought your super awesome fluffy inflatable noodle stick. What’s next?

Either they’re a massive fan and purchases again every week or more likely, they’ll fall off the grid within a few months.

Dear customer, we miss you! To bring them back, implement the re-engagement email campaign.

Starter workflow:

  1. Trigger when 30 days has passed since last purchase or app open.

  2. Send email with latest content or re-engagement offer (coupon code, items, new features).

  3. Repeat every month.

####Additional advanced steps:

  1. Wait 1 day.

  2. If email is not opened, send another email or push notification.

  3. Repeat every month.

The re-engagement campaign invites dormant users to come back and rediscover why they fell in love with your product or store. On average, we see open rates of 25-35% e-commerce companies.

Hopefully you were able to see the immense value of email in this post. If you’re looking for a powerful email automation solution for creating an onboarding, cart abandonment or re-engagement campaign, I invite you to check out Iterable. If you are already on Segment, sending user data and events to Iterable is as easy as flipping a switch.

About Iterable

Iterable is an all-in-one email platform for growth hacking the inbox. The solution covers 100% of your email needs by sending triggered, promo and drip campaign emails. Iterable also includes a plethora of built-in tools like dynamic segmentation, mobile previews and A/B testing to make sure every single email campaign is fully optimized.

Erin Franz on February 5th 2015

Analyzing your behavioral data in a SQL database with tools like Segment Warehouses and Looker gives you a few key advantages: You can customize all of your analysis to match your individual business – like defining user sessionsbased on how people use your product. And, you can make sure that you’re accurately connecting anonymous and logged in users with a universal ID.

But that’s only the beginning.

With these building blocks you can dive into complex funnel and event flow analysis to gain insight into your users’ behavior. This post (the third in my threepart series) will show you how.

Why Use SQL for Funnel Analysis? 

SQL allows data analysts to create custom queries, define events, and identify & categorize users in the precise ways they need to create a useful and informative funnel. With SQL, data analysts can better understand how users are flowing through the funnel and completing relevant events.

Creating an Event Funnel

In most applications, there is a sequence of events you’d expect the user to navigate through to achieve an ultimate goal or conversion. For example, in e-commerce this is generally the sequence of events that ultimately lead to a purchase. This concept is use-case agnostic however, so long as you can determine an expected and desired event flow, you can set up a funnel. You probably already have an idea of what this event sequence should be, and in that case we can easily start tracking this funnel using our sessions.

Circling back to session generation, once we’ve established the events in our session (referred to in my previous post as Mapped Tracks) and marked them with a session ID, we can start establishing if our funnel events occur in each session. For this example, we’ll assume our funnel looks like this:

This implies the each user starts the funnel by viewing the buy page, and an amount of user drop off occurs at each proceeding step: Added Item, Tapped Ship, and Completed Purchase. Tracking the percentage of sessions that drop off between each step can identify potential areas for improvement within design and messaging. To easily track these events, we can add them to the Session Facts view we created previously:

Now we have the number of occurrences of each event per session. In the case of this funnel, we actually only need to know if each event occurred at least once. We’ll then want to sum the amount of sessions where this is true. This is easily done in the LookML:

We can simply run these measures for the desired time window to get the values for the conversion funnel, visualized here:

Show Percent Change has been enabled as well, so we can easily see the session drop-off between steps. In this funnel, we can see there is probably an issue between tapping ship and making a purchase that is worth looking into.

How to Define Your Funnel

Often it is ideal to have the ability to be flexible and experiment with different funnels for your business or organization. Or you may want to see the results of a few different funnels before evaluating which one best represents your product flow and most important user actions. In these cases, we’ll want to build out a Custom Event Funnel, where we can choose which event counts we’d like to measure each time we run the analysis.

Since each event in the Tracks view has already been mapped to sessions, we can also calculate the amount of sessions with each event type from there via a distinct count of sessions. And because we’d like to be flexible with the event type, this is a good use case to take advantage of Looker’s Templated Filterfeature that can be used to create filtered dimensions and measures. Here, we want to define a filter for an arbitrary event type that we can use to filter a session count. Adding the following LookML to the Tracks view will accomplish this:

Event1 is a filter only field that can be populated with the desired event type. The event1_session_count measure then filters on the event1 input and calculates a distinct count of session_ids. We can then create event2 and event2_session_count etc. up to the number of events that we’d like to experiment with in the custom funnel. You can see the same funnel we created in the previous analysis as represented by the custom funnel in the following visualization:

Event Flow Analysis

Event funnels can provide a great high level view of application performance. But at a more granular level, it’s often interesting and valuable to see the exact flow or path from or ending at a particular event. This analysis will rely on event sequencing that we completed in conjunction with assigning session IDs to events in the Sessions Map from the previous post. In this case, let’s limit our flow analysis to five events. By joining the sessions map to itself on increasing sequence numbers, it’s easy to create a flow starting from each event.

After persisting this result in a derived table and joining the view to Tracks, we can explore the result set. For example, after filtering on added_item as the first event, we can examine the most common event paths:

It seems in this application, once the user has added an item, it’s likely they will continue to add or remove items. Generalizing this result set a bit further, we can also see what the drop-off percentage is with each proceeding event, regardless of event type. This is easily accomplished by adding the following syntax to the Tracks Flow view file for each event number, which counts the number of events when the specified event is not null.

These measures can then be visualized as the amount of sessions that drop off after a particular event, in this case, Added Item.

This analysis can be particularly useful to identify events that are prone to losing users and prevent them from converting. In this case, it looks like users are prone to continue application use after adding an item, which makes this event a great indicator of user engagement or “stickyness.”

Getting Started

Many web analytics solutions predefine how you should analyze your data. Looker allows you the flexibility to make your own rules as they apply to your unique business or organization. Universal User ID mapping, custom sessionization, and advanced funnel analysis are only a few possibilities with a Looker-Segment joint solution. This combination enables you to access and analyze your data on your own terms.

To learn more, visit segment.com/warehouses and www.looker.com.

Erin Franz on January 29th 2015

This post is the second in a three-part series from Looker, a Segment Warehouses partner, sharing strategies to solve common analytics conundrums. On to user sessions!

As we mentioned in the first post, universal user IDs are the foundation for complex web and behavioral analysis. The next step is tying those single identities to a string of actions, which is what we call a user session.

Some out-of-the-box tools will do this for you automatically. However, when they do the reporting under the hood, it’s hard to know exactly how they calculate a user session, and if it’s right for your business. Instead, we recommend using SQL and LookML to build out user sessions yourself.

By transforming event-level data to metrics from the ground up, you can design them to your use case, gain greater flexibility and dig deeper into the details. With the basis of a universal user ID, this post will show you how you can sessionize user activity.

What Is a Session?

Simply, a session is defined as a string of user interactions that ends when specific criteria are met. For example, a user session might be defined as every action a user takes from when they land on your app to when they log off, or reach a 30 minute interval.

Sessions are the building blocks of user behavior analysis. Once you’ve associated users and events to a particular session identifier, you can build out many types of analyses. These can range from simple metrics, such as count of visits, to more complex metrics, such as customer conversion funnels and event flows (which we’ll approach in the third post). Assuming we already have a Universal Alias ID methodology in place, we can also examine session metrics over time, such as user lifetime values and retention cohorts.

Many prepackaged web analytics solutions include sessionization, but they typically implement very “black box” version, giving the end user little insight into or control over how sessions are defined.

Different businesses may want to vary session definitions by the user inactivity required to terminate a session, how much buffer time is added to the last event in a session, and any other more custom requirements pertinent to a specific application’s use case. They might also want to differ session logic across devices, since behavior varies greatly based on screensize. For instance, in e-commerce, users on mobile are more likely to be researching on their phone to purchase in store in comparison to web users.

With Looker’s custom LookML modeling layer, you have complete control over how sessions are defined.

Universal User ID Refresher

In the previous post, we covered how to create a map from disparate user identifiers to a single Universal Alias ID. This process is integral to creating the most accurate event analytics, and therefore session definitions. Thinking about it simply for one user as they login:

The diagram shows the transition from Anonymous ID to User ID. If we didn’t map A1 and U1 to a common identifier, we’d either create two distinct sessions by using both IDs, drop all the events pre-login if we chose only the logged-in user ID, or not be able to map these events to subsequent visits if we choose the anonymous ID. Setting up a Universal Alias Mapping resolves this issue, so we just get one session encompassing both pre-login and post-login events, with user traceability to future sessions.

How to Build Sessions

Session creation can be completed in Looker in a few steps using persistent derived tables (PDTs). PDTs allow you to create views from SQL queries that have been written to a scratch schema that Looker has write access to. These views can then be referenced throughout our model.

First, let’s persist the critical elements of the tracks table mapped to the Universal Alias ID. You’ll see that we’ve left joined in the existing universal_alias_mappingtable that we previously created to accomplish this. The sql_trigger_valuedetermines how often the table is updated and can be customized to the implementation. In this case, I’ve set it to when CURRENT_DATE changes, or each day at midnight.

From these mapped tracks, we’ll create our sessions in another persistent derived table. Let’s assume our session definition foremost relies on elapsed inactivity time. First, we’ll need to determine the amount of idle time between events themselves. This step can be accomplished using the lag() function in Redshift.

Idle_time is the time in minutes between the current event and the previous event for the mapped user. Once we have that value we can set how much inactivity is necessary to terminate a session, and then begin a new one on return. In this case, we’ll assume this is 30 minutes, which is a commonly used timeout window, but this can be assigned to any time value based on the duration you’d expect between your events when a user is active.

Our original query is now aliased as the the subquery lag. From that base, we can select only events where lag.idle_time is greater than 30 minutes or when lag.idle_time is NULL(meaning it is the first session for the user).

The timestamps of these events are the session start times. The session identifier can simply be taken from the combination of the User ID and the session sequence number, which will be unique for each session. A session sequence number is assigned by choosing the row number after ordering the sessions by start time and partitioning by user. Boom! Now we have the ability to calculate metrics such as sessions per day and sessions per user.

Tying Up Sessions

Now, we’ve marked the events corresponding to each session start, but we still need to identify the events contained within the session and the events ending the session. This will require another step in Looker.

Note that previously in the session query, in addition to determining the start time of the current session, we also determined the start time of the next session — which will be important here. Once we’ve persisted the sessions we’ve just generated in a PDT, we can create what we refer to as a Sessions Map using the following syntax:

Referring back to our Mapped Tracks table, we’ll join the newly created Sessionstable on user_id, where the tracks event timestamp (sent_at) is between the session start (inclusive) and next session start (exclusive). This enables us to assign a session ID to each event in Mapped Tracks. Then we can determine the end of a session using the following query involving the persisted SessionsTracks, and newly created Sessions Map.

Using the LEAST() function in Redshift enables us determine the time of the end of the session – the next session start time or the time of the last event of the current session plus 30 minutes, whichever comes first. This 30 minute value is the “buffer” time added to the timestamp of the last event, and can be customized easily in the SQL as is relevant to the use case. In addition, we can compute the number of events in the session in this step. Persisting the resulting table (we’ll refer to this as Session Facts) and joining it back to sessions give us the complete basic session metrics: User ID, Session ID, Session Start, Session End, and Events per Session.

Using Sessions to Perform Bounce Rate Analysis

Now that we’ve built our customized sessions, we can go ahead and analyze them. Custom session generation enables you to know exactly what your metrics mean and get the most value from them, since you define how they are built – from start to finish. With this method, you can analyze session counts, session duration, events per session, new/repeat usage, user cohort analysis and much more. To give an example, we’ll focus on a commonly used metric in web analytics based on sessions: bounce rate.

Bounce rate can be a great measure of how “sticky” your content is, since it measures how many people drop off before they become engaged with your application. A bounced session is usually defined as a session with only one event. Since the number of events per session is defined in our Session Factsview, you can easily add the dimension is_bounced to identify bounced sessions in your model:

Assuming we’ve joined the Session Facts table to Sessions in the LookML model, we can now use the is_bounced dimension to segment sessions. A simple example is daily trending bounce rate and overall percentages. These elements can additionally be dimensionalized by any other attributes from the tables we’ve joined in, such as geography, time, and campaign to determine their respective “stickiness” or user engagement.

You Can Do It!

A lot of value is provided from sessionization when it can be customized specifically for your use case and desired definitions. A solution that gives you the flexibility to define your own rules when it comes to structuring user event behavior for your business is important to accomplish this. We build off these custom user sessions in the third blog post of this series, where we extend sessionization to custom funnel and event flow analysis. Check it out!

Want to learn more about Looker and Segment? Let us know.

David Cook on January 26th 2015

Our awesome customer, David Cook from Jut, graces the blog to tell us how he created an actionable product usage display with event tracking + Segment + Keen + LED lights. Read on!

What is an Information Radiator?

Now that companies are collecting tons of data on what users are doing in their products (you are collecting user data, aren’t you?), the challenge shifts from figuring out what users are doing to disseminating that information to the company.

Obviously, you can discuss the data you’ve analyzed with team members and summarize data at company meetings, but in those cases you’re usually just sharing a snapshot of historical data. If you really want to be a data-driven organization, you have to constantly beat the data drum and make data accessible to everyone at all times.

Enter the information radiator. Alistair Cockburn coined the term and defines it like this:

“An Information radiator is a display posted in a place where people can see it as they work or walk by. It shows readers information they care about without having to ask anyone a question. This means more communication with fewer interruptions.”

The most common information radiator is a wallboard – a TV that constantly displays information. However, humans have a natural instinct to tune out things that aren’t relevant.

If you’re not careful, your team might unconsciously start ignoring your wallboard. This is why, while wallboards are great for most kinds of data, it’s valuable to take advantage of alternate means of constantly communicating information to your team.

My data communication tool of choice are LEDs.

What’s So Great About LEDs?

LEDs add depth to your data visualization arsenal. They’re more engaging than a wallboard because they’re unusual. Everyone sees TVs on a daily basis, whereas few people see LEDs that actually display information rather than simply act as a source of light. You may be more constrained with the characteristics you can alter (color, brightness, and speed) but LEDs still provide plenty of flexibility to display meaningful information.

You can configure LEDs into a variety of shapes: individual pixels, arrange pixels into a matrix, or string a strip of LEDs together.

We use LED strips because they’re easier to setup and allow you to construct a larger installation that more people are likely to see. Specifically, we use Heroic Robotics’ LED strips and control them with the PixelPusher. This combination simplifies the act of controlling individual LEDs on the strip.

Displaying User Actions with LEDs

So now that you have some LEDs and data, you need to figure out exactly how you want to unite the two.

It’s best to measure and display the moments where users derive value from your product, so your team can strive to make more of those moments occur.

At Jut, the main way our users derive value from our product is by writing and running programs in our new language, Juttle, that retrieve and display data. Consequently, we fire an analytics event whenever one of our users takes this action. To visualize this, we decided to send a pulse of light down an LED strip for each of these events.

To give us the flexibility to use any tool to track product usage, we decided to implement Segment to control our event reporting.

Segment makes it easy for us to send these events to services like Intercom and Google Analytics with a single integration. We take advantage of Segment’s webhooks feature to send events to our own database, and use it to push data to Keen, where we get the LED signals from.

In our closet, we have a server that runs a java program. This program communicates with the PixelPusher over our network to tell it what to do with our two LED strips. Every minute the program pings Keen to request the timestamps and status of the Juttle programs run in the last minute.

The java program then plays back the last minute of Juttle program runs. In other words, the PixelPusher will send pulses down the strip at the same pace as the Juttle programs were run instead of sending the pulses all at once. That means, if you go to our website and run a Juttle program, one minute later a green pulse will shoot down the LED strip in our office like this:

Here is the repo if you’d like to check it out..

How We Use the Data

Unfortunately, like any program or SQL query, not every Juttle program runs perfectly. Sometimes they encounter a runtime error and fail. We want to avoid those, so when that happens, a red pulse goes down the strip instead of a green pulse.

You might want to send pulses for other actions as well. For example, we send an orange pulse down the strip whenever someone signs up for our beta. To differentiate it from the Juttle run pulses, we don’t rely on just changing the color, we also vary the speed that it moves down the strip. It’s half as fast as a typical pulse.

All in all, this creates a more lively atmosphere in the office. We can easily see how active our users are in almost realtime. If it seems like we’re experiencing an unusual amount of traffic, you can turn to our wallboard to see how the current level compares to historical levels.

What else do you think you could use LEDs for?

Let us know on Twitter @jut_inc!

Erin Franz on January 20th 2015

We welcome Erin Franz, data analyst at Looker, to the Segment blog! This is the first post in her three part series sharing practical advice for common analytics conundrums: accurately identifying users, creating sessions for user activity, and event path analysis.

Let’s dive into the first topic — how to work with user IDs.

The Problem of Disparate User IDs in Web Analytics

The user is at the center of every event in web analytics. An ID for that user is assigned to each event, but this identifier is only as accurate as the context and timing of the event.

For example, what happens if a user visits our website on their laptop, and then visits again on their mobile phone? A login or authentication process brings us closer to a single identifier for this user — but what about events pre-login? What if a user changes their email or username?

Raw events are often isolated or separated by their assigned user ID, preventing true user identification when these events are analyzed on their own.

Why Do We Need a Universal User ID?

Raw event counts are unaffected by user ID discrepancies. The number of logins, pageviews, cart adds, etc. will be the same no matter how the user is identified. But, these event counts mean a lot more if coupled with an accurate count of users who are active on your application, and the ability to trace these users over time to measure conversion funnels.

The majority of advanced analytics, from user behavior to retention, relies on user identification that accurately tracks users through all of their visits.

If we aren’t careful about stitching these user identifiers together, active user counts can get inflated by double-counting the pre- and post-login IDs — and only partial visit behavior can be examined because a single user’s activity gets split into two separate “users.” For example, without joining pre- and post-login behavior through a universal ID, it’s impossible to identify which campaigns or site features are most likely to lead a customer to pay after signing up.

How to Define a Universal ID with Looker and Segment

Luckily, we can make our analyses accurate by using Looker and the data provided by the Tracks and Aliases tables in Segment Warehouses. What’s recorded in Tracks and Aliases will vary on the Segment implementation, but we’ll make some general assumptions for this example.

Track events, which record customer interactions, such as “Signed Up” and “Completed Purchase,” automatically collect the current anonymous ID (created pre-login) and user ID (created upon login) when available for each event. Aliasrecords when a user ID changes by marking a previous ID (before change) and a current user ID (after change).

We can simplify a typical user event-tracking scenario using the below diagram, where A represents pre-login anonymous IDs and U represents authenticated user IDs. Current state is on the left, and our goal is to transform this data to look like the diagram on the right.

The left of the diagram represents one user with three visits to the application, resulting in events reflected by five IDs. Consider this scenario: On the first visit in this sequence, the user with Anonymous ID A1 logs in as username U1. Events associated with that user have either or both A1 and U1 assigned to them. Simple.

But on the second visit, the user’s Anonymous ID is assigned as A2 and the user logs in as U1, but then changes their username to U2, resulting in events with three distinct identifiers: A2, U1, and U2. Lastly, the user returns with Anonymous ID A3 and logs in simply with the new username U2.

The ultimate goal here is to provide an accurate mapping from any one of the five identifiers to one single user ID, as demonstrated in the diagram to the right and below it in Table 2, the Universal Alias Mapping table.

Query Recipes for Consolidating User IDs

You can accomplish this in a few steps in Looker. First, we need to create the Alias to Next Alias mapping table, as shown in Table 1. This will consist of all the possible combinations of Anonymous ID and User ID from your Tracks tables, to map pre-login to login IDs. Additionally, we’ll need to include all the possible combinations of Previous ID and User ID from the Alias table, to map User IDs to changed User IDs. The union of both result sets will yield Table 1.

Once we have this result set, we need to map all values in the Alias column to a Universal Alias, which will be the most current user ID. In this case it is U2. This can be achieved by joining the table onto itself many times where the prior table’s next_alias equals the joined table’s alias attribute.

In some SQL dialects the number of joins can be made dynamic via a Recursive CTE, but in Redshift this function is not available — so we’ll just accomplish the same thing by joining a finite number of times (more times than a user ID could ever be re-aliased).

The above logic left joins the original table to itself up to five times on next_alias = alias. This creates a row for each original alias mapped through, at most, five user ID changes. (More or fewer joins can be used, depending on the context of the Segment implementation.)

The most recent value for the alias is chosen by coalescing backwards through the last available value to the first, resulting in the universal ID for that alias. This value is then optionally anonymized to a numeric value using a hashing algorithm. The end result is a mapping table as modeled in Table 2.

Measuring Accurate Active User Counts

In Looker, this mapping table can be updated automatically at any frequency and stored in a materialized table. We can then reference it throughout our Segment Warehouses LookML model. The view file abstracts the result set from the underlying query, creating the mapping table. As a result, the end user is only exposed to the result set and doesn’t have to worry about any underlying complexity, while the data analyst can easily modify the logic if necessary.

In this case, we’ll join the Universal Alias Mapping view to the Tracks view in our model file. The Tracks view creates a similar abstraction for the Tracks table in Segment.

This LookML syntax ensures that whatever ID column is populated in the Trackstable (user ID or anonymous ID) is properly aliased to the latest alias. Since we have joined in the Universal Alias Mapping table, we can use it to compute more accurate user metrics as defined in the Tracks view file below (mapped_user_idand count_distinct_userssupplementing the original fields tracks.anonymous_idand tracks.user_id).

Since our mapping table will not contain a mapping for a track where user identifier is the universal ID, the mapping for those values will be null. So ultimately, the user identifier will be a coalesce of universal_alias_mapping.universal_user_idtracks.user_idtracks.anonymous_id, as defined in the mapped_user_id dimension. We can then define our count of active users as a count distinct of the derived mapped_user_id value.

How Looker Can Help

Every Segment implementation is unique, and Looker’s LookML layer allows you to customize any aspect of your model. With this flexibility, you can catch edge cases and gain tremendous freedom in defining metrics specific to your application. Your data is transformed into a simple set of definitions that can power the analytics of your entire department or organization.

I hope you’ve enjoyed learning how to track events to a single user. My next two posts are going to get even more exciting, as we build off this foundational element of a universal ID to create custom session definitions and measure visit behavior. Subscribe to the Segment blog to be sure to catch them!

Want to get started with Looker & Segment? Let us know.

Become a data expert.

Get the latest articles on all things data, product, and growth delivered straight to your inbox.