Using Enrichments

Using Enrichments

by on ‎02-25-2016 02:03 PM - edited on ‎04-04-2017 09:20 PM by Community Manager (1,743 Views)

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 more info.)
  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 session timeouts:
      • Web sessions: 30 minutes (10 minutes if only one event is triggered)
      • Mobile App sessions: 2 minutes
      • Ominichannel sessions: 1 minute
  4. (Optional) Select an existing Rule condition or create a new Rule.

Linked Enrichments

When two or more Enrichments have a dependency on the same attribute, they become "Linked Enrichments". As an example, let's take a look at the Enrichments applied to Visit Start and Visit End, the two preloaded attributes (see screenshot below).

linked_enrichments.png

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.

 

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 eg. page_type="purchase"
  • an Event attribute for the dollar amount of the purchase eg. 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 eg. 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 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 don't 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 eg. 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 valules 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 eg. page_type="purchase"
  • an Event Number attribute for the dollar amount of the purchase eg. 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.