- TLC Home Home
- Discussions & Ideas Discussions & Ideas
- Product Guides Product Guides
- Knowledge Base Knowledge Base
- Developer Docs Developer Docs
- Education Education
- Blog TLC Blog
- Support Desk Support Desk
This article describes the tally attribute and how to use it in the Customer Data Hub.
In this article:
Before you begin, familiarize yourself with the following:
The tally attribute maintains a collection of key/value pairs, called entries, that count the occurrences of named items across many events.
product_category
attribute "Shoes".For example, to keep track of the product categories that a visitor purchases from, use a tally named "Product Category Purchases" and enrich it with the names of product categories found in the event attribute product_category
when purchase events occur. Over time the tally will provide valuable information about the visitor's buying habits.
Numeric values are stored as decimals or integers. Choose the type that matches your needs:
By default, each tally attribute generates a corresponding string attribute that automatically captures the name of the tally entry with the highest value. This string attribute has the same name as the tally, but with the word "(favorite)" appended. For example, a tally named "Product Categories Purchased" would also have a string attribute named "Product Categories Purchased (Favorite)".
The tally attribute is available in the following scopes: Event, Visit, Visitor.
The following table illustrates the example of a tally named "Product Category Purchased", which counts the number of times each product category was purchased from. This tally automatically populates a string attribute with the name of the entry containing the highest value.
Tally Attribute: "Product Category Purchased" | |
Tally Key | Tally Value |
"Shoes" | 1 |
"Pants" | 3 |
"Shirts" | 7 |
"Shorts" | 2 |
String Attribute: "Product Category Purchased (Favorite)" | "Shirts" |
Increment a number within a tally based on the value of another attribute. For example, to track the number of times each product category is viewed, use a tally named Product Category Viewed and enrich it with the product_category
attribute. The values of product_category
become entries in the tally.
The number attribute stores a number for browsing metrics such as visits, page views, and events. Common examples include Lifetime Value, Order Total Transaction, or Days Since Last Purchase.
To specify the number type, select Decimal or Integer from the Type drop-down list.
Attribute Name: "Product Category Viewed"
Starting Value | {"Shoes": 7, "Pants": 1, "Shirts": 3} |
---|---|
Enriched With | product_category:"Shoes" |
Resulting Value | {"Shoes": 8, "Pants": 1, "Shirts": 3} |
Increment a tally entry based on a custom name with a custom value or another attribute value. For example, use a tally named "Product Category Searched" and enrich it with a hard-coded value of "Did Not Search" when a search has not occured (a condition likely based on a boolean attribute that keeps track of searches). Since the name "Did Not Search" would not naturally occur in a product_category
attribute, this enrichment is used to add the custom entry.
Attribute Name: "Product Category Searched"
Starting Value | {"Shoes": 7, "Pants": 1, "Shirts": 3} |
---|---|
Enriched With | Custom Key: "Did Not Search" Custom Increment: 1 |
Resulting Value | {"Did Not Search": 1, "Shoes": 7, "Pants": 1, "Shirts": 3} |
Increment the values in a tally by the values found in another tally.
Attribute Name: "Product Category Purchased (Lifetime)"
Starting Value | {"Shoes": 7, "Pants": 1, "Shirts": 3} |
---|---|
Enriched With | {"Shoes": 1, "Shirts": 2, "Dresses": 1} |
Resulting Value | {"Shoes": 8, "Pants": 1, "Shirts": 5, "Dresses": 1} |
Increment the entries in a tally based on the entries in a set of strings. For example, use a tally named "Product Category Searched (Lifetime)" to track the product categories searched per visit, and enrich it with a set of strings named "Product Categories Searched (Visit)" at the end of each visit.
Attribute Name: "Product Category Searched (Lifetime)"
Starting Value | {"Shoes": 7, "Pants": 1, "Shirts": 3} |
---|---|
Enriched With | Product Categories Search (Visit):{"Shoes", "Pants", "Hats"} |
Resulting Value | ["Shoes": 8, "Pants": 2, "Shirts": 3, "Hats": 1} |
The rolling average is the arithmetic mean of numerical values captured over time. These values come from number and tally attributes that are all collected as entries in a Timeline. The timeline's expiration determines which entries can be factored into the final average. If there is no expiration date, it is a simple average solution.
For a detailed example, see Number/Tally Enrichment: Set Rolling Average Based on Timeline.
Attribute Name: "Average Product Category Purchase Amounts"
Starting Value | {} |
---|---|
Enriched With |
Timeline entry: |
Resulting Value | {"Shoes": 130.00, "Pants": 75.00, "Shirts": 30.00, "Hats": 25.00} |
A rolling sum is the aggregate of numerical values in a number or tally, attributes that are captured as entries in a timeline. The Timeline's expiration determines which entries can be factored in during the aggregation. For detailed information, see Number/Tally Enrichment: Set Rolling Sum Based on Timeline.
Attribute Name: "Average Product Category Purchase Amounts"
Starting Value | {} |
---|---|
Enriched With |
Timeline entry: |
Resulting Value | {"Shoes": 260.00, "Pants": 150.00, "Shirts": 90.00, "Hats": 25.00} |
Set the tally to the values defined in two corresponding arrays. For example, use a tally named "Product Category Quantity Purchased" to capture the quantity of products purchased and enrich it with the two arrays product_category
and product_quantity
when a purchase event occurs.
Attribute Name: "Product Category Quantity Purchased"
Starting Value | {} |
---|---|
Enriched With |
|
Resulting Value | {"Shoes": 1, "Pants": 1, "Shirts": 3} |
Remove tally based on a set of conditions.
The remove tally enrichment can be used to reset a tally. For example, if you have been tracking visitor's product category searches, you might clear that tally once an order is placed.
Attribute Name: reset tally to zero
Starting Value | {"Shoes": 1, "Pants": 3} |
---|---|
Enriched With | Purchase event occurs |
Resulting Value | {} |
Remove an entry in a tally based on a set of conditions. For example, use a tally named "Product Category Searched" to track a visitors product searches (and potential purchases) then use this enrichment to remove the tally entries that match items in a purchase.
Attribute Name: "Product Category Searched (Not Purchased)"
Starting Value | {"Shoes": 7, "Pants": 1, "Shirts": 3, "Jeans": 10} |
---|---|
Enriched With | product_catgory : "Shoes" |
Resulting Value | ["Pants": 1, "Shirts": 3, "Jeans": 10] |
Increment by one (1) for each item in an array. For example, use a tally named "Product Category Purchased" and enrich it with the array attribute product_category
when a purchase event occurs.
Attribute Name: "Product Category Purchased"
Starting Value | {"Shoes": 1, "Pants": 1, "Shirts": 3} |
---|---|
Enriched With | product_category : ["Pants", "Ties"] |
Resulting Value | {"Shoes": 1, "Pants": 2, "Shirts": 3, "Ties": 1] |
Copyright All Rights Reserved © 2008-2021