Computed attributes
EARLY ACCESSCalculate existing profile attributes and events to create new attributes to use in your campaigns for segmentation, targeting, and analytics.
Computed attributes enable you to make your data go even further. Computed attributes look like regular profile attributes and work in a similar way to offer richer options for audience targeting and segmentation in Journey campaigns and communication personalization.
There are 3 types of computed attributes:
- Event aggregates - Make calculations against event data
- Custom formulas - Make calculations against different Customer Profiles profile data
- Profile scores - Evaluate profiles according to fit and behavior criteria
Computed attributes automatically update as the profile data in your Customer Profiles instance changes. This way you can always trust that the data is current and accurate.
To access Computed attributes, go to Customer Profiles → Configuration → Computed attributes tab.
Computed attributes lifecycle
While computed attributes look and work similarly to regular profile attributes in most scenarios, they are complex data types that involve specific steps to manage their lifecycle.
During draft you can build:
- Refine and test the computed attribute as many times as you need to ensure that the data output is correct for your requirements.
- When you are satisfied with your draft, activate the computed attribute to start the processing phase.
- The computed attribute will be calculated and applied to every profile in Customer Profiles. This can take some time if you have many profiles in your instance.
- When processing is complete, the computed attribute will be active.
Once active, computed attributes automatically update as the profile data in your Customer Profiles instance changes.
Every time a computed attribute is calculated, a new timestamp is applied to a person profile for the update. Keep that in mind if you are triggering your Journey based on when profiles are last updated (Modified At).
Active computed attributes are not editable. If you wish to make edits you can duplicate a computed attribute and make edits to the newly created draft duplicate.
You can delete draft attributes without any issue. However, to ensure data stability, it is not possible to delete computed attributes that are being used in other computed attributes or active Journeys.
You can check the computed attributes area to see where every computed attribute is being used. Inactive computed attributes can be deleted but remember to always check before you delete as the deletion process is permanent and cannot be undone.
Event aggregates
Event aggregates are a type of computed attribute that are calculated from profile event data. For information about how data retention affects event-based computed attributes, see Data retention for events. They help to calculate aggregated information such as:
- What is the total value of orders the customer makes in order to establish customer lifetime value (LTV)?
- How many total purchases has the customer made?
- How many times has the customer visited a specific page in last 30 days?
- What is the average customer purchase when using loyalty points for a purchase?
- How many emails has the customer received from us in the last 14 days?
To create an event aggregate, go to Customer Profiles → Configuration → Computed attributes tab and select Create new → Event aggregate.
Define event aggregate
Event aggregates are made up of the following component parts:
- An aggregating function used to make the calculation.
- An event and event property. For example, if you want to calculate the average value of the Order Value property in the Checkout Completed event. The Count function takes no property as it is calculated on the number of event instances.
- Optional event property filters. For example, if you only want to calculate the sum of purchases that were paid for with a credit card (Payment Method is Card).
- An optional selector to exclude the first or last matching event from aggregation. For example, you can choose to Exclude first from your aggregate that counts the number of repeat purchases.
- A time period to filter events during a chosen period of time.
Create the event aggregate by choosing an aggregating function and selecting the event and event properties you wish to calculate, then define the time period within which the events occurred. Your event aggregate will be calculated for all events in the chosen time period.
Give the attribute a name and then test your calculation on a person profile.
Aggregating functions
Select from the following aggregating functions:
| Function | Description |
|---|---|
| Count | Track the number of occurrences of an event. |
| Sum | Get the sum of values for an event property. For example, the total price for multiple Item Purchased events. |
| Min | Store the smallest value of an event property. For example, minimal Price value in Item Purchased events. Min can also store the earliest time value from the standard Event Time event property or a custom datetime property event. |
| Max | Store the largest value of an event property. For example, maximum Rating value in App Rated events. Max also stores the latest time value from the standard Event Time event property or a custom datetime property event. |
| Average | Store the average of values for an event property. |
| First | Find the value of a property of the first event that happens. For example, Item in the first Item Purchased event. |
| Last | Find the value of a property of the last event that happens. For example, Item in the last Item Viewed event. |
| Exists | Use as a flag to track if an event happened or not. Result returns true if the profile contains the chosen event. |
Set time period
Select from the following time periods:
| Time period | Description |
|---|---|
| Lifetime | All event occurrences |
| Last 7 days | All events from last 7 full days, but not including events that occurred today |
| Last 14 days | All events from last 14 full days, but not including events that occurred today |
| Last 30 days | All events from last 30 full days, but not including events that occurred today |
| Last 60 days | All events from last 60 full days, but not including events that occurred today |
| Last 90 days | All events from last 90 full days, but not including events that occurred today |
| 24 hours | 24 hours before current time |
| Custom period | All event occurrences since a chosen date, or all event occurrences starting from n days before today |
Test event aggregate
You can test your event aggregate on a profile at any time in the creation process.
Choose the profile that you wish to test your event aggregate against and then get instant results as you construct and test your formula:
- Select Create and exit when you first create your event aggregate to save it as a draft.
- In draft, the event aggregate is not active and it will not be visible in person profiles.
- You can edit this attribute as many times as you need when it is in draft.
- When you want to save your draft edits select Save and exit.
- Toggle Activate event aggregate attribute when you are happy with the calculation.
- It will start processing against profiles in your Customer Profiles instance.
Your event aggregate will only be active once it has processed against all profiles. If you wish to adapt an active event aggregate you can deactivate it, make your changes, and then reactivate it again.
Custom formulas
Custom formulas are a type of computed attribute that you can use to make profile attributes even more powerful. You can automatically calculate values based on standard and custom profile attributes in order to provide an additional way of engaging your audience and provide service in a more personalized way.
This is possible using Expression Language. The expression language in its base form comprises one or more constants, attributes, functions and operators in a formula that outputs an expression value. This value can then be stored as a custom attribute in a person profile.
As an example, you could use a custom formula to calculate the conversion rate of an email campaign if you are capturing emails sent and emails clicked data. The formula would look something like this:
round(100\*(email_link_clicks/emails_sent),0)
If the value of any attribute in a custom formula is empty (not defined), then the expression will return an empty value for the profile.
Create custom formula
To create a custom formula:
- Go to Customer Profiles → Configuration → Computed attributes tab.
- Select Create new → Custom formula.
- Build your formula by typing in attribute names, functions, and operators in the formula builder. The formula builder will offer auto-suggestions of available functions and attributes as you type.
- You can also use the Add function and Add attribute pickers. A dropdown list of available functions and attributes will open where you can make your selection and construct the formula.
- Choose from standard, custom and active computed attributes (Profile scoring and Event aggregates).
- If you make a mistake you will see an error message and be able to make the fix.
See the Expression Language reference section for a detailed description and examples for all available functions and operators.
Test custom formula
You can test your formula at any time in the creation process. Choose the profile that you wish to test your expression against and then get instant results as you construct and test your custom formula:
- Select Create and exit when you first create your custom formula to save it as a draft.
- In draft, the custom formula is not active and it will not be visible in person profiles.
- You can edit your custom formula as many times as you need when it is in draft.
- When you want to save your draft edits select Save and exit.
- When you are happy with the formula you can toggle Activate custom formula to start the activation process to add the custom attribute to all profiles in Customer Profiles.
- During processing the formula is calculated for the whole audience.
- A progress bar helps you track processing progress in the dashboard.
- Once complete the custom formula is visible in an attribute across all profiles.
It is best practice to wait until the custom formula is fully active before you use it. If you attempt to use the computed attribute while it is processing you may find that segments and filters using the custom formula may be missing profiles.
You cannot edit active or processing custom formulas. This means that you will need to duplicate the formula you wish to edit and then make your changes to the new version.
Once you have tested and verified that your new changes are working as expected the formula will be processed again. When it is active you can then discard the old custom formula.
Remember to always check before you delete a computed attribute because deleted computed attributes cannot be restored and will be deleted permanently.
Profile scores
Profile scores can help you gain more actionable insights from your leads and customer data. A profile score is a number assigned to a profile so that you can compare and order profiles by multiple criteria using a single score.
There are plenty of use cases for scoring profiles, the most popular are lead scoring, credit scoring, and behavior scoring.
How profile scores work
Customer Profiles implements rule-based scoring so that you can turn your domain knowledge into a simple set of rules around the criteria you apply to your audience. Each rule has scoring points assigned to it.
The running total of all rules applicable to a single profile is called a profile score. The output is always an integer value.
What can be scored:
- You can create rules for standard, custom, and active computed attributes to work out how a profile fits your 'ideal customer'.
- To cover the behavioral part you can create rules regarding customer interactions, be it standard events (channel, platform events, or changes to profile) or custom events.
Any rule can be assigned a positive and negative number of score points to provide you with even more flexibility.
Create profile scores model
Before creating your model ensure that you have configured and enabled all events you want to use in your scoring model.
To create a profile scoring model:
- Go to Customer Profiles → Configuration → Computed attributes tab.
- Select Create new → Profile scoring. The newly created model is in a draft state meaning that it is not applied to profiles and thus no corresponding attributes have been created.
- Select Add rule to create rules for all of your criteria. You can add rules for standard, custom, and active computed attributes (custom formula and event aggregates) and events.
For event rules the following operands are supported:
- Occurrence -
happened - Frequency -
equal to X times,less than X times,less or equal X times,more or equal X times,more than X times - Recency -
any time,within the last X minutes/hours/days,before the last X minutes/hours/days,between the last X and Y minutes/hours/days - Event properties (such as payload) use the same operands as event properties in the segment editor
Test the model
Test the model on a profile. The model will be immediately applied to the selected profile.
If any changes occur to the profile after the model has been applied, you should select the refresh icon to refresh the profile data or reapply the model by selecting the profile again.
Activate the model
When your model is ready:
- Toggle to activate it.
- Once active, the model enters a processing state where it makes calculations for all existing profiles.
- As it is being calculated, a corresponding computed attribute is created for the model with the same name as the scoring model.
- New profiles get scored automatically right after creation.
The profile score will be visible inside the computed attribute on the profile card of a profile.
Models cannot be modified or deleted after activation unless you disable them first. You can still review the model in view-only mode and test it against the profile if needed when it is in an active or processing state.
See the results and start using them in Customer Profiles segments and custom formulas, as well as find them integrated in Journeys.
Modify or delete the model
To modify or delete the model:
- It should first be disabled to put the model into a disabled state.
- When a model is disabled, profiles that already contain a score will see that the score does not update for new events or changes.
- Profiles that are created after a model is disabled will not have a corresponding computed attribute containing a score.
When a model is deleted the corresponding computed attribute will be wiped out from all profiles. Deletion is permanent so to ensure data stability you cannot delete a profile scoring model if the profile scoring computed attribute is in use in a Journey or as part of another custom formula or event aggregate computed attribute.
Profile scores best practices
Consider these recommendations when defining your profile scoring rules:
- There are different opinions on whether to split your score on profile fit and behavioral score or have a single score that encompasses both profile and behavioral data. This depends on your use-case. Customer Profiles gives you the flexibility to do both.
- Add rules sequentially for each criterion, one-by-one.
- The typical recommendation for the profile fit is 4-6 criteria, with the number of rules depending on granularity you are looking to achieve and maintain.
- Behavioral criteria vary depending on the engagements you use, but typically include clicks on links in your campaigns, form submissions, and web activity (such as page views, gated content downloads, and cart interactions).
- When you decide to replace a model it is better to disable and not delete the old one straightaway. That way you can compare and analyze results.