An enrichment is the application of business rules in setting attribute values. An enrichment transforms an attribute from a static value to a dynamic one.  By introducing business rules to your attributes you give them context and more meaning. These enriched attributes then become the building blocks for rest of your solution.

In this article:

Table of Contents Placeholder

Managing  Enrichments

Adding an Enrichment

Enrichments are added to attributes as a way to customize their values. Find the attribute you want to enrich and follow these steps:

  1. Click Add Enrichment and select the desired enrichment.
  2. The settings vary depending on the kind of enrichment.
    See enrichment details below for additional information.
  3. Select WHEN to trigger the enrichment. This controls the timing of the enrichment.
    • New Visitor – occurs the first time a visitor comes to your site.
    • New Visit occurs on a new visit by a visitor.
    • Any Event – occurs on any event.
    • Visit Ended occurs when a visit ends, based on the following time of inactivity:
  4. (Optional) Select an existing Rule condition or create a new rule.

Linked Enrichments

When two (2) or more enrichments have a dependency on the same attribute, they become "linked enrichments". The following example shows the Enrichments applied to Visit Start and Visit End, the two preloaded attributes The enrichment in the Visit Start attribute uses the Visit End attribute and vice versa. Because each enrichment is linked to the other by an attribute, they are considered linked enrichments.

WhiteUI_UsingEnrichments_VisitStart and VisitEnd Linked Enrichments_Combined Screens.png

Read more:

Usage Examples

Increment or Decrement Number – "Lifetime Order Total (LTV)"

This enrichment can modify a number with a positive value (increment) or a negative value (decrement). This value can come from another attribute or be set as a static number.

Use Case

  • Attribute: Lifetime Value (LTV)
  • Scope: Visitor
  • Data Type: Number

Knowing the amount spent across all orders from a visitor is a valuable piece of information. This data can be used for many purposes, such as to offer promotional deals or to assign a badge to visitors whose spending exceeds a certain threshold. Since the value of this attribute will persist for the lifetime of the visitor, it will be visitor-scoped.

This enrichment has the following requirements:

  • an event attribute to identify when a purchase is made, for example: page_type="purchase"
  • an event attribute for the dollar amount of the purchas, for example: order_total="123.45"

To configure this enrichment:

  1. Create a visitor attribute with the number data type, titled "Lifetime Order Total (LTV)"
  2. Add the "Increment or Decrement Number" enrichment
  3. Select order_total from the drop-down list.
  4. Select Any Event from the WHEN drop-down list.
  5. Create a new rule titled "Order Thank You Page" with the following condition:
    •  page_type EQUALS " purchase"

Set Difference Between Two Dates – "Days Since Last Purchase"

This enrichment calculates the elapsed time between two events and stores the numeric value in one of the following units: minutes, hours, days, weeks, or months.

Use Case

  • Attribute: Days Since Last Purchase
  • Scope: Visitor
  • Data Type: Number

This enrichment will calculate the number of days since a visitor made a purchase. The resulting value is always a positive number.

This enrichment has the following requirements:

  • an event attribute to identify when a purchase is made, for example: page_type="purchase"
  • an visitor attribute to capture the date of a purchase event

To configure this enrichment:

  1. Create a visitor attribute with the number data type titled "Last Purchase Date".
  2. Select Any Event from the WHEN drop-down list.
  3. Create a new rule (if it doesn't already exist) titled "Order Thank You Page" with the following condition:
    • page_type EQUALS "purchase"
  4. Create a visitor attribute with the number data type titled "Days Since Last Purchase".
  5. Add the "Set Difference Between Two Dates" enrichment.
  6. Set the two (2) dates to: "Visit start" (built-in attribute) and "Last Purchase Date".
  7. Set the units to "Days".
  8. Select New Visit from the WHEN drop-down list.

Split String (A/B Testing – "Split Test Group"

This enrichment defines visitor group names and assigns them to an attribute based on a percentage distribution. The names (or values) of your segments can come from another string attribute or from a custom value. This enrichment is helpful in running A/B tests or targeting groups of users.

The group distributions are calculated based on a random number generator. The enrichment does not monitor the current ratio of segments prior to assigning a value, so for smaller samples you may see ratios that do not exactly match the percentages you set. However, as the number of assignments increases, the ratio of assignments will gradually match the percentages you set.

For example, if you set up three segments with distributions of 50%, 30%, and 20%, within a small sample set you might see ratios of 48%, 34%, and 18%. However, as more visitors get assigned into the segments, the ratio values will approach the expected values.

Use Case

  • Attribute: Split Test Group
  • Scope: Visit/Visitor
  • Data Type: String

To test a new campaign on a small segment of your visitors, presumably before rolling it out for all visitors, you use the split string enrichments to assign a small percentage of your visitors into the "Action" group. This identified segment of visitors can then be built into an audience for which you can take actions.

For this example we will create the following distribution of segments:

  • 85% - "Control" - the control group that will not be part of the test
  • 15% - "Variation1" - the group to be included in the test

To configure this enrichment:

  1. Create a Visit/Visitor attribute with the String data type, titled "Split Test Group"
  2. Add the "Split String" Enrichment
  3. For each group, set a name and a percent
  4. Select New Visit from the WHEN drop-down list

Now you can use this attribute in a rule to include the relevant visitors in an audience. The rule logic might be: "Split Test Group" EQUALS "Variation1".

Store Array as Set of Strings – "Purchase Categories"

The Store Array as Set of String enrichment saves the values from an array of strings attribute into a set of strings attribute. This Enrichment will not create a perpetual set. Meaning, you cannot append to a set of string using this enrichment, it will always overwrite the value. To preserve a set of strings and append new values you must use the Update Set of String By Set of Strings Enrichment.

Use Case

  • Attribute: Purchase Categories
  • Scope: Visit
  • Data Type: Set of Strings

Starting with an event attribute of the data type Array of Strings called product_category, populated on purchase events to contain the category names of the products purchased.  To store this as a Visitor/Visit attribute called "Purchase Categories", it must be converted to a Set of Strings. Then, on each purchase event, the product_category values get appended to the "Product Categories Purchased" attribute via enrichments.

Array of Strings (product_category) Set of Strings (Product Category Purchased)
["Pants", "Shirts"] "Pants", "Shirts"
["Boots", "Belts", "Belts"] "Boots", "Belts"

Update Set of Strings by Set of Strings "Lifetime Purchase Categories"

This enrichment appends the values from one Set of Strings attribute into another Set of Strings attribute.  This allows you to store the values that occur in one set (and that change from event to event) into a second set that persists for the life of the visitor.

In this table Set A is overwritten with new values for each event and the the enrichment is copying those values into Set B where the master list grows.

We recommend pairing this enrichment with Store Array as Set of Strings Enrichment so that the resulting Set can be preserved before it is overwritten by incoming values.

Set A (Event) Set B (Visitor)
"Pants", "Shirts" "Pants", "Shirts"
"Shoes", "Pants" "Pants", "Shirts", "Shoes"
"Shirts", "Shirts", "Watches" "Pants", "Shirts", "Shoes", "Watches"

Use Case

  • Attribute: Lifetime Purchase Categories
  • Scope: Visitor
  • Data Type: Set of Strings

To maintain an accumulated set of product categories purchased from you will have one Event Array of Strings attribute and two Visit/Visitor Set of Strings attributes: one to capture the views as they happen and one to capture all historical views.

This enrichment has the following requirements:

  • an event attribute to identify when a purchase is made eg. page_type="purchase"
  • an Array of Strings event attribute to identify product categories during a purchase, for example: product_category=["Boots", "Belts"]
  • a Set of Strings Visit attribute to capture product categories purchased for the visit
  • a Set of String Visitor attribute to capture all product categories purchased

To configure this Enrichment:

  1. Create an event attribute with the Array of Strings data type named "product_category"
  2. Create a visit attribute with the Set of Strings data type, named "Product Category Purchased"
    • Add the "Store Array as Set of Strings" enrichment
    • Select the attribute "product_category"
    • Set the WHEN to "Any Event"
    • Set the Rule to the "Purchase Page" (page_type EQUALS "purchase")
  3. Create a visitor attribute with the Set of Strings data type, named "Lifetime Product Category Purchased"
    • Add the "Update Set of Strings by Set of Strings" enrichment
    • Select the attribute "Product Category Purchased"
    • Set the WHEN to "Visit Ended"

Set Rolling Average Based on Timeline – "90-Day Order Average"

This enrichment calculates the rolling average (arithmetic mean) of numeric values captured in a timeline attribute.

This example uses a "90-Day Orders" timeline to capture order total values over the last 90 days. As the Timeline progresses, entries falling outside the expiration window are discarded and the final rolling average is recalculated with the set of valid entries.

This example also applies to the Set Rolling Sum Based on Timeline enrichment.

The table below illustrates a timeline of entries (assume today is March 25). All entries, including the entry on Jan 1, are included in the arithmetic mean.

Timeline Attribute: "90-Day Orders"
Valid Entries Order Total ($)
Jan 1 10.00
Feb 15 20.00
Mar 25 30.00
Rolling Average is (10.00 + 20.00 + 30.00) ÷ 3 = 20.00

A few weeks later, the Jan 1 entry is discarded because it falls outside the 90 day expiration and the rolling average is recalculated for the valid entries. Notice how the resulting average changes when an expired entry is excluded from the aggregate.

Timeline Attribute: "90-Day Orders"
Expired Entries Order Total (in $)
Jan 1 10.00
Valid Entries Order Total (in $)
Feb 15 20.00
Mar 25 30.00
Apr 10 40.00
Rolling Average is (20.00 + 30.00 + 40.00) ÷ 3 = 30.00 

Use Case

  • Attribute: 90-Day Order Average
  • Scope: Visitor
  • Data Type: Number

Starting with a timeline attribute to capture order totals from the last 90 days, you will create a new visitor attribute using the Rolling Average enrichment to store average the order totals. 

This Enrichment has the following requirements:

  • an Event String attribute to identify when a purchase is made, for example: page_type="purchase"
  • an Event Number attribute for the dollar amount of the purchase, for example: order_total="123.45"
  • a Visitor Timeline attribute to capture order totals for 90 days
  • an Visitor Number attribute to capture the average of order totals

To configure this enrichment:

  1. Create a Visitor Timeline attribute named "90-Day Order Timeline".
  2. Click Create An Entry > Set Expiration and set it to "90 days".
  3. Click Create An Entry > Update Timeline and set the following:
    • Record: Time of event received
    • Capture data: order_total
    • WHEN: Any Event
    • Rule: page_type EQUALS "purchase"
  4. Create a Visitor Number attribute named "90-Day Order Average"
  5. Add the "Set Rolling Average Based On Timeline" enrichment with "order_total" and "90-Day Order Timeline" selected.