Any Industry

Using predictive purchase behavior to increase campaign ROI

In this recipe, you’ll learn how to predict the likelihood a user will purchase an item or subscribe to a product within a 30-day timeframe. And use that information to optimize marketing campaigns to deliver the right offer, at the right time, in the format your customer expects.


Made by Vidora

What do you need?

  • Javascript or Mobile source to track and collect events

  • Vidora, a no-code machine learning platform

Using predictive purchase behavior to increase campaign ROI

Collect data once with Segment and send it any tool you use. No more tedious integrations. No more engineering resources wasted.

Start with Segment

The foundation for building personalized experiences is based on having access to reliable and clean first-party data. With access to this data, you can power machine learning models to predict relevant content recommendations, user interactions, or even help forecast revenue.  

To start building these experiences, the first step is to use historic event data to segment users into specific audiences. For example, if we are trying to create a segment of users we think are most likely to purchase, we may define that as:

  • Users who have purchased an item in the past

  • Users who haven’t purchased within the last month

  • Users who have been active within the past week

Once you have identified the audience parameters, you can then use them to train machine learning models to make predictions on specific customer actions, like purchasing an item. This recipe will walk you through how to create purchase predictions using Segment and Vidora, a no-code machine learning platform.

Step 1: Capture User Behavioral Events and Traits

The basis for any machine learning prediction is historical user behavioral data - events and traits. The first step to track user behavioral events is to sign up or log in to the Segment App. Next, create a source for your Mobile and/or Web Apps. After you set up your source, you’ll begin to implement events. Events are essentially actions — such as screen views or button clicks — performed by your users on your App. You can implement events by bundling our Android, iOS, or Web SDK with your App. 

Check out these docs to learn more about setting up your source.


The most important event to track will be the one that tracks the conversion event we are trying to predict, in this case, a Purchase (Order Completed) or Subscription (Plan Subscribed) event.  Tracking other events and traits is also important for creating an accurate prediction. The more events and traits we feed our models, the better our predictions will be.

Even though some events may have a smaller predictive value than others, the model will still learn from all the events and traits available making the predictions incrementally better. The ability to utilize all your customer data helps Vidora make better predictions than using only a subset of the data.

Step 2: Setup the Vidora Destination in Segment

To create this prediction, we will be sending the user events and traits being collected through Segment source over to Vidora’s Machine Learning Platform, Cortex. 

To set up the Vidora destination, you will need to do two things

  1. Copy the API Key from your Vidora Cortex account

  2. Use this API Key to enable the Vidora destination in Segment


Step 3: Predict the Likelihood of Purchase/Subscription

Once the Vidora destination is set up, you can start building your predictions. This prediction will be built using a Future Events Pipeline. Vidora Cortex is a no-code platform that will automatically transform the raw data being received from Segment into user predictions. Meaning, the setup for this prediction will be very quick and straightforward.

First, we start by defining the outcome we are trying to predict. The events that can be chosen for the prediction are the same events being tracked in Segment. Here we’ll choose to predict the likelihood a Purchase will happen in the next 30 days, but that event could also be Subscribe, Churn etc.


The next step is to select which customers should be included in the prediction. If the prediction should only be made for paying users, or for users only in a specific geography, you would define those criteria at this step.


Finally, you need to select a training schedule for this prediction. If the prediction is only going to be used once, it can be set up to not retrain. However, if this prediction will be used multiple times, you can set up the training schedule to ensure user predictions are always up to date with the most recent user data.


Step 4: Understand what predicts Purchases or Subscriptions

After your pipeline finishes training and generates predictions for each user, you can begin to understand the primary drivers behind a prediction. One important step of a Machine Learning Pipeline is to create Features from the raw data, and it’s these features that the model uses to learn and make predictions. This step happens automatically when you create a Pipeline in Vidora Cortex.


Here, you can see the features that were automatically generated, ranked in order of importance, which indicates the features that were most predictive of Purchases. In this example, you will notice that past purchases and subscriptions are very important, as well as downloading the mobile app. And even though the least important feature is a marketing click, you can see it still has some importance in the Pipeline, meaning it adds incremental value and accuracy to the prediction.

Step 5: Export Predictions back to Segment

Once your prediction has been created and has finished training (which usually happens within a few hours depending on the size of the user base) you can export the user predictions directly back to Segment. 

Within your Vidora Cortex dashboard, you can set up Segment as an Export Destination. This way, every time your prediction is updated and new probabilities are assigned to your users, your predictions will automatically be sent back to Segment using the Segment sources API, ensuring your data is always up to date with the latest predictions.

Setting up Segment as an Export destination is a three-step process:

  • The first step is to create an HTTP API Source in Segment, and copy the Write Key.

  • Then, use this write key to create a Segment Export Destination in Vidora Cortex.

  • Finally, set up a recurring export from your Future Events Pipeline which automatically sends all predictions back to Segment.


💡 Tip: Enable Continuous Learning

Because the data integrations between Segment and Vidora are automated once set up, this means that you can continually feed data into your Machine Learning Pipelines from Segment and continually export Predictions back to Segment from Cortex. This allows you to operationalize all of your predictions so that as new data is captured your predictions are updated accordingly. 

Step 6: Activate predictions in your favorite tools

You can connect your Segment source that’s receiving prediction data from Vidora to any of our 300+ destinations to achieve your use cases. Here are some examples:

  • Use Personas to create an audience of “Likely to purchase an item within the next 30 days” and run targeted ads via Facebook Pixel destination

  • Connect Braze destination with your source to trigger personalized emails when the likelihood score is high

  • Send predictions to Salesforce to forecast your revenues

Wrapping up

Here’s what we’ve done in this growth recipe:

  • Created a source on Segment to capture user behavioral events and traits

  • Sent your user behavioral data from Segment to the Vidora destination

  • Used Vidora’s Platform to predict the likelihood that a user will take an action (like Purchase or Subscribe) in the next 30 days

  • Exported all user predictions back to Segment in real-time and sent them to your favorite tools

Getting started is easy

Start connecting your data with Segment.