Technical walk-through of a Customer Data Platform use-case

Alan Bluwol
Technical Walkthrough — Photo by pixpoetry on Unsplash

The intent of this article is to walk through an example implementation of a real-time, trigger-based engagement workflow using just two components of the modern customer data stack, including Segment’s Customer Data Platform and HubSpot’s Marketing Automation Platform.

The growth of new marketing technologies is out of control. There are over 7,040 vendors in the 2019 Marketing Technology Landscape Supergraphic by, rendering the graphic itself too overwhelming to digest.

One component of the stack is the Customer Data Platform (CDP).

A Customer Data Platform is a system that aggregates and unifies customer data across every touch point, so you can understand exactly who your customers are and what motivates their actions. By taking a unified approach to data collection, your engineering team can save months of time spent integrating each marketing and analytics technology separately.

While there are slight differences across CDP vendors, there are four common elements that all true CDPs must offer. Accordingly, a Customer Data Platform is a system that enables you to:

  • Collect data from every customer touch point
  • Unify profiles and store customer data in one place
  • Segment customers into meaningful audiences
  • Activate customer data and audiences in tools needed to drive personalisation and revenue

Once your data is unified, CX teams can use a CDP to build actionable segments to personalise every customer interaction. By creating target audiences with a CDP instead of your end tools, you can keep your segmentation rules and messaging consistent across channels.

The role of CDP

Build a real-time, trigger-based customer engagement workflow

After seeing the art of what’s possible with a CDP, I went on a small mission to implement a quirky demonstration of how I could leverage our own systems and data to create a real-time, trigger-based customer engagement workflow of my own:

The outline of the objective is:

  • Tap into our custom built app to capture user behaviour data — I’ll use our very own Consultancy Portal (js application) that all consultants use to access company wide information
  • Look for a very specific behaviour — Identify consultants that are searching for “Alan” (that’s me)
  • Add them to an audience — Group consultants that behave the same way
  • Add them to a campaign — Target them with an email, based on their behaviour
  • Do all of the above in real-time

You might be thinking “oh, but that’s pretty straight forward and that could just be programmed into the Consultancy Portal”. But consider the following use-cases:

In addition to the above objective,

  • only target consultants that have a specific title — relies on our CRM data
  • only target consultants that are about to come off engagements in the next fortnight — relies on our Resource Portal data
  • only target consultants that have searched for Alan twice in the last 5 days — relies on long-term behaviours, not just one off events
  • only target consultants that didn’t end up on my profile page, after searching for me — relies on long-term outcomes, not just simple events
  • create a task for them in Salesforce CRM
  • add the consultant to a custom audience in a Facebook social campaign
  • send the audience to my behavioural analytics platform to dive deeper into consultant journeys

All of the above requirements seem relatively straightforward — but require a stream of consultant behavioural data to be analysed in real-time tapping into data sets from across multiple systems and looking at quite specific properties and outcomes, then delivered to wherever I need it to go. All of this can be done by digital, marketing and customer experience teams via Segment’s Customer Data Platform.

In the following diagram, I’ve outlined a high-level overview of individual components as we’ve architected them to provide the business full and multi-speed control over customer data to fulfil the various requirements of both data and non-data teams, independently and collaboratively, without hindering overall momentum or effort.

High-level architecture of our implementation

In this article, I’m going to focus on Segment and HubSpot specifically.

Once Segment and HubSpot instances were provisioned and working correctly, the following is the list of steps required to achieve the objective outlined in the intro:


  • Instrument Tracking
  • Program Identify & Track Events
  • Personas
  • Configure Computed Trait
  • Configure Audience
  • Configure Destination — HubSpot


  • Configure Contact Fields
  • Configure Active List
  • Configure Marketing Email
  • Configure Workflow

Step 1

Instrument the custom built Consultancy Portal Application (js) with the Segment javascript tracking code, and send events to the Segment API. Segment often provide snippets of code for you to embed and configure on your sites and apps.

Example tracking code to add to website

This is the only technical bit that needs to be done by a systems engineer once per event to track on the website, mobile or server application side. Once this is done and live, it’s usually not touched again unless changes are made to the system.

Segment interface

In the above diagram, you can see that we’ve configured 5 source systems to send data into Segment, including the Consultancy Portal, a custom Google Analytics connector, Public Website, HubSpot and Salesforce.

Step 2

Ensure that Identify and Track events are flowing through into Segment as planned.

Identify Events contain information about the identity of the person being tracked. From Consultancy Portal, this is the consultants id, name and email, which is sent to Segment each time a consultant is added to the portal automatically. For websites and mobile apps, this would typically be done when a user submits an application form, contact form, or login (or identifies themselves in some way).

Segment — Identify Event

Track Events contain information about what the person is doing. From Consultancy Portal, this is tracking what someone is entering into the search field, and sent to Segment each time they submit the search form. For website and mobile apps, this can be any event deemed appropriate to track meaningful behaviour — like clicking on certain call to actions, reaching a point within a page, playing with pricing calculators, submitting an enquiry, adding/removing an item to cart, starting a live chat conversation on a specific topic — practically anything.

Segment — Track Event

Events can be configured with any number of properties as required for use in analysing and segmenting the audience.

When a consultant navigates to the Consultancy Portal, and enters text in the search bar in the top right hand corner, a track event will be sent to segment.

Screen grab of the search bar on the Consultancy Portal app

The track event is called “Search” and within it, it contains properties about the search. The property of interest is “searchText” — what the user entered.

Segment — sample of event from Consultancy Portal

Step 3

Configure Segment Personas

Personas is a feature of Segment that brings event information together into a single profile through a process called Identity Resolution (using those Identify Events from earlier) and allows users to configure traits and audiences for activation into other systems — like Marketing tools.

In this example, I’ve got Consultancy Portal feeding into Personas, so that as a non-technical business user I can tap into consultant behaviours from tracked events to identify my target audience for my campaign.

Separately, I’ve also got Consultancy Portal going straight into a destination — our Data Warehouse in BigQuery — so that as a technical data analyst/engineer/scientist, I can blend tracked behaviours with other enterprise system data in my warehouse to perform advanced analytics.

Segment Source to Destination Mapping

Step 4

Configure Segment Personas Computed Trait

Computed Traits allow non-technical users of Segment to identify and label specific patterns of behaviours from one or more tracked events. It’s typically a sequence and aggregation of tracked events with a specific criteria over a period of time. Think of traits as derived insights or trends of customer behaviour data. These traits once calculated are added to a customers’ profile.

Segment — Types of Computer Traits

In this example, the Computed Trait is counting the number of times a user performs a “search” where the “search text” equals “Alan”.

Segment Computed Trait — Criteria

The logic for a Computed Trait can have multiple, nested conditions with a range of filters and comparisons — making it incredibly powerful.

There are multiple ways in which traits can be computed — counters, aggregations, most frequent, first, last, etc. Computed Traits run off the data stream of events within Segment, and can be computed in real-time, depending on the type of computation.

Perhaps the most powerful type of Computed Trait is the SQL Computed Traits. It can be used to augment a customer profile in Segment with more and advanced insights directly from the Data Warehouse, which is likely to include a more complete view of enterprise wide system data, and therefore customer data.

You can run complex queries directly against your warehouse, and surface those traits into customer profiles in Segment for use by Product and Marketing to build sophisticated and highly targeted customer audiences. If you’re using Google BigQuery as your warehouse, for example, you could even run BigQuery ML (machine learning) models for computing things like Life Time Value, Attrition, Attribution, and Product Cross-sell Propensity.

Step 5

Configure Segment Personas Audiences

Audiences allow non-technical users of Segment to identify, group and label specific customers that behave the same way, according to custom defined criteria over raw tracked events, their properties and computed traits. Think of these as target customer cohorts/segments/groups which we can assign actionable strategies and execute customer engagements.

In this example, and just as before, the Audience is defined as customers who performed a “search” where the “search text” equals “Alan”. Alternatively, the criteria could have been where the customer contains the Computed Trait we created earlier.

Segment Audience Criteria

The logic for an Audience can have multiple, nested conditions with a range of filters and comparisons — making it incredible powerful.

All customers who meet the defined criteria will become a member of an audience, and be labelled as such in the customer profile. It’s possible to fall in and out of audiences, depending on whether or not you meet the criteria at different points in time.

Step 6

Configure Segment Personas Audience Destinations

When a customer becomes a member of an Audience within Segment, that customer data can be integrated and synchronised to a Destination system for activation, like Marketing Automation, CRM, Personalisation, Search and Social Advertising, Analytics… even a Storage Bucket.

In this example, there are 13 customers in the live Audience that searched “Alan” in the Consultancy Portal, and each of them will be synchronised to Hubspot as Contacts. As new customers meet the criteria and become a member of this audience, they too will be synced to HubSpot automatically and in real-time.

Segment > Hubspot Destination Configuration

In Segments Customer Profiles we can see each individual profile, and their events, Computed Traits and Audience memberships.

We can see this specific customer in Segment has met the conditions for being a member of the Audience “Consultancy Portal Searched Alan” that we created earlier.

Segment Audience Membership

Step 7

Configure HubSpot Contact Custom Field Mapping

When Segment synchronises Audiences to Destinations, it will attempt to take the value of Traits and Properties from Segment Customer Profiles to populate fields with the same name in Contact records in the target Destination.

In this example, the customer became a member of the Audience “Consultancy Portal Searched Alan” in Segment, so it was assigned an Audience Trait “consultancy_portal_searched_alan: true”.

In HubSpot, you have to create a new Custom Contact Field with the same name as the Audience Trait name from Segment. Thankfully, this is a painless process that took 2 minutes to do in HubSpot.

Segment to Hubspot Field Mapping — for synchronisation

Step 8

Configure HubSpot Active List

In Hubspot, like most Marketing Automation solutions, there is the ability to create an Active List, in which Contacts can dynamically become members upon meeting defined criteria.

In this example, the list is finding members with the Contact Custom Field with the name “Consultancy Portal Searched Alan” is “true”.

Remember, this field was set by Segment during the Audience Destination sync, therefore membership to this list is triggered by Segment.

Hubspot Active List Filter

Step 9

Configure HubSpot Marketing Email

In Hubspot, a Marketing Email was configured to use a specific email template with personalisations to be sent by a HubSpot Workflow.

Hubspot Email

Step 10

Configure HubSpot Workflow

In Hubspot, a Workflow was created to trigger an email send. In this example, when a contact is enrolled in the HubSpot Active List ‘Searched Alan’, the contact is sent a Marketing Email.

Remember, this whole process is kicked off by Segment capturing events, creating and syncing audiences, and Hubspot enrolling contacts to lists to trigger an email!!!

Hubspot Active Workflow

End Result

Real-Time, Trigger-based Customer Engagement

Outcome of real-time workflow

As you can see although there are a number of steps involved, they’re not that technical. It’s pretty much a series of GUI based configurations and simple handshakes between different systems based on data points with the same name. And if it only took a few hours to configure and test this workflow end-to-end, just imagine what you can do with a dedicated team of marketers, product designers and data analysts…