Authors: @Danny-Miller , Shrutivj, Jenny Medeiros,
![Banner Image.jpeg Banner Image.jpeg](https://experienceleaguecommunities.adobe.com/t5/image/serverpage/image-id/35855iBAE6060702FF6BBA/image-size/large?v=v2&px=999)
This post describes how we approached the challenge of obtaining deltas from audience segments so that Adobe Experience Platform clients can export the users they need when they need them.
This blog details a single implementation or customization on Adobe Experience Platform. Not all aspects are guaranteed as general availability. If you need professional guidance on how to proceed, then please reach out to Adobe Consulting Services on this topic.
Adobe Experience Platform allows clients to easily segment user profiles into specific, attribute-based audiences using their Real-Time Customer Profile data. Through segmentation, clients can distinguish marketable customers and effectively tailor their marketing strategies, such as email campaigns.
Recently, an Adobe Experience Platform client requested the ability to create a single segment that could be reused for both the initial population as well as changes to that population over time. For example, to pull users who qualified for the segment on day one, the users who qualified yesterday, or the users who no longer qualify and were removed from the segment today.
This post details our approach to delta segmentation to provide this and all future clients with a more granular view into their segments to refine their marketable audiences and fully leverage Adobe Experience Platform services.
The challenge
Simply put: the challenge was to develop a way for Adobe Experience Platform clients to retrieve the variation in a segment — the delta.
On day one, the delta is every user who was added to the segment. On day two, the delta becomes every one who was added and removed from the same segment. Consequently, we needed to achieve the following:
- Refine the data from Real-time Customer Profile to determine which users were added or removed from the segment.
- Identify the exact time and date when a user-entered or exited a segment for effective filtering.
- Enable Adobe Experience Platform clients to export the deltas from any timeframe, and at their own convenience.
These new filtering capabilities would not only give Adobe Experience Platform clients better control over their audiences but also enable them to reuse a single segment. For example, if they were to run a segment again, they could simply exclude the results from yesterday’s run, removing the need to create an entirely new segment with the same business rules.
Our approach to delta segmentation
Our first line of action was to analyze the current process of segmentation extraction in Adobe Experience Platform. We found that there are two steps involved:
- Segment qualification: This is a segment job that scans the users streaming into Real-Time Customer Profile and adds qualified users to the segment, or removes those that no longer qualify.
- Segment export: The segment export job outputs the data collected in the segment to the corresponding channels. See Figure 1 below.
Figure 1: Diagram of the steps required when checking a segment.
Next, we enlisted two parameters that could serve as filters during the segment’s export job. These parameters are: segment status and segmentQualificationTime.
Segment status: As the name implies, this is the status of segment participation in the current request. The segment status must be equal to one of the following three rules:
- Realized: The entity has just qualified to be part of the segment.
- Existing: The entity continues to be in the segment.
- Exited: The entity is leaving the segment.
SegmentQualificationTime: This is the timestamp given to the assertion, or segmentMembership, that enables us to know exactly when a user-entered or exited the segment.
As a side note, the status and qualification time are stored in Real-Time Customer Profile itself, allowing each one to manage its own state and time. This simplifies profile lookups since no external application is needed to retrieve this information.
Exploring how the parameters affect a segment
To illustrate how these new parameters affect a segment, we will now describe three different scenarios in which we add a user profile to the segment, remove a profile from a segment, and run the same segment twice.
Scenario one: adding a profile to the segment
For this first scenario, we took a dataset in Adobe Experience Platform, created a segment with a number of profiles and ran it. The next day, we added a new profile that qualifies for the segment.
Then, we performed a profile lookup (see Figure 2) and were able to pinpoint the exact time that profile qualified for the segment (October 3rd at 15:05:33), and the status (“realized”).
Figure 2: Results of the profile lookup after adding a new profile to the segment.
The snapshot above also shows how segmentMembership captures the parameters we need to find the profiles that fall into a segment.
Scenario two: removing a profile from the segment
At this point, we know the last timestamp and status for the qualified profile. For this second scenario, we removed the profile from the segment. As a result, we can observe in Figure 3 that the qualification time and status have changed.
Figure 3: Comparison of profile lookups after removing a profile from the segment.
This status change means clients can filter their segment by status to find the users who exited the segment within a specific timeframe.
Scenario three: running the same segment job again
In this final scenario, running a segment job for the first time sets the profile status to “realized.” If no changes are made to the data and the same segment job is run again, we can see in Figure 4 that the profile status switches to “existing,” while the timestamp remains unchanged.
Figure 4: Comparison of profile lookups after running a segment job again.Knowing that the segment status changes while the timestamp remains constant if no profiles are changed enables clients to retrieve deltas from the “last checked” timestamp.
Filtering segments into deltas
Now that we are able to track when user profiles enter and exit a segment, we can obtain the deltas by filtering the segment export job using combinations of segmentQualificationTime and status.
To get profiles who have just entered a segment:
- segmentQualificationTime AND status <> exiting
To get profiles who have exited a segment:
- segmentQualificationTime AND status = exiting
For a better understanding of how this works, consider the following examples for entry deltas and exit deltas.
Entry deltas
In this export job example, we filter the segmentQualificationTime by start time and end time. This will return only those profiles which entered the segment between that timeframe.
As shown in Figure 5, we haven’t specified the status in the filter, leaving the export job to run with status “realized” or “existing”.
Figure 5: Sample payload of a segment export job for entry deltas.
The payload shows that we only need to filter segmentQualificationTime to obtain entry deltas. This parameter will then scan for timestamps and collect the profiles that fit within the specified timeframe.
Exit deltas
In contrast, for exit deltas, we must configure both segmentQualification and status. In the payload shown in Figure 6, we specify both parameters to return only those profiles which exited the segment during the given timeframe.
Figure 6: Sample payload of a segment export job for exit deltas.
Similarly to entry deltas, the two parameters scan for the defined conditions and export only the profiles that qualify.
Challenges of delta segmentation
At first, we were faced with reviewing all the available parameters involved with segmentation extraction. This was considerably difficult since, at the time, there was no clear documentation outlining all the parameters for evaluating and accessing segmentation.
We also experimented with capturing user profiles with other methods, such as based on specific event criteria. This method, however, required us to modify our existing data model, which we were reluctant to do solely to provide deltas to our clients.
Instead, we requested the addition of segmentQualificationTime and status to Real-Time Customer Profile. This approach ultimately enabled a much more streamlined way of filtering segments and profiles from Adobe Experience Platform and is reusable across any type of segment or data model.
Empowering clients with delta segmentation
We’re excited to provide Adobe Experience Platform clients with this highly-requested feature. Motivated by their feedback, we worked closely with various Adobe teams to develop a solution that not only enhanced the process of exporting segments for our clients but also led us to ensure comprehensive and up-to-date documentation.
Now with the knowledge gained during the development of this solution, we are better prepared to progress this particular feature and continue providing new and improved segmentation capabilities for our clients.
For a detailed guide on parameters and filters for segment jobs, check our tutorial on segmentation.
Follow the Adobe Experience Platform Community Blog for more developer stories and resources, and check out Adobe Developers on Twitter for the latest news and developer products. Sign up here for future Adobe Experience Platform Meetups.
Originally published: Feb 13, 2020
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.