Repeat purchase scoring

Predict the likelihood that a new customer will buy again.

In this tutorial, we'll show you how to:

  • Deploy your repeat purchase scoring predictions using a pipeline

Along the way, we'll point you to other documentation you need to configure prerequisites. If you'd rather have every step all on one page, see our Repeat purchase scoring quickstart

Let's dive in.

  1. You'll need a Faraday account — signup is free!

Confirm your data

Unless you’ve already created them for another quickstart or purpose, you’ll need to add the following cohorts to your account:

  • One-time purchasers
  • Repeat purchasers
  • Customers

Cohorts

What’s a cohort?

A cohort is Faraday’s term for a commercially significant group of people — for example, a brand’s customers, leads, or even “people who bought X and Y and then cancelled.”

Cohort membership is fluid — continuously computed by Faraday — and is defined by events its members must all have experienced and/or traits its members must all share.

For example, a Customers cohort could be defined as the group of people who have all experienced a Transaction event at least once.

For more, see our docs on Cohorts, Events, Traits, and Datasets (which define how events and traits emerge from your data).

API via cURL
Dashboard

To verify, use a GET /cohorts request. Your response should look like this:

[{
  "name": "One-time purchasers",
  "id": "$ONE-TIME_PURCHASERS_COHORT_ID"
, ...}{
  "name": "Repeat purchasers",
  "id": "$REPEAT_PURCHASERS_COHORT_ID"
, ...}{
  "name": "Customers",
  "id": "$CUSTOMERS_COHORT_ID"
, ...}]

Make note of the IDs of the necessary cohorts.

If the required cohorts aren’t there, follow the instructions using these buttons, then return here to resume.

Confirm your predictions

Unless you’ve already created it for another quickstart or purpose, you’ll need to add the following prediction in your account:

  • Outcome: Likelihood to buy again
Outcomes

What’s an outcome?

An outcome is what you use in Faraday to define a propensity objective, such as likelihood to convert, buy again, or churn.

For more, see our docs on Outcomes.

API via cURL
Dashboard

To verify, use a GET /outcomes request. Your response should look like this:

[{
  "name": "Likelihood to buy again",
  "id": "$LIKELIHOOD_TO_BUY_AGAIN_OUTCOME_ID"
, ...}]

If the required outcome isn’t there, follow the instructions using this button, then return here to resume.

Deploy your predictions

Now you’ll create the pipeline necessary to deploy your predictions.

Create a pipeline for repeat purchase scoring

API via cURL
Dashboard

Use a POST /scopes request:

curl https://api.faraday.ai/scopes --json '{
  "name": "Repeat purchase scoring",
  "population": {
    "include": [
      "$ONE-TIME_PURCHASERS_COHORT_ID"
    ]
  },
  "payload": {
    "outcome_ids": [
      "$LIKELIHOOD_TO_BUY_AGAIN_OUTCOME_ID"
    ]
  }
}'

Your pipeline will start building in the background. You can proceed immediately with the next set of instructions. When your pipeline is done building, you’ll get an email.

Deploy your repeat purchase scoring pipeline

Deploying to CSV as an easy example

This section describes how to deploy your predictions to a CSV file that Faraday securely hosts (and continuously updates) for you to retrieve either manually or on a scheduled basis using your existing data infrastructure.

Most Faraday users eventually update their pipelines to deploy to data warehouses, cloud buckets, or databases. To do that, you’ll add your destination as a Connection and then choose it instead of Hosted CSV.

For more, see our docs on Pipelines and Connections

API via cURL
Dashboard

Use a POST /targets request:

curl https://api.faraday.ai/targets --json '{
  "name": "Repeat purchase scoring in CSV",
  "scope_id": "$REPEAT_PURCHASE_SCORING_SCOPE_ID",
  "representation": {
    "mode": "identified"
  },
  "options": {
    "type": "hosted_csv"
  }
}'

Your pipeline will finish building in the background. You can proceed immediately with the next set of instructions. When it’s done, you’ll get an email—then you can return to this pipeline and click the Enable pipeline button to activate it.