- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
This Enrichment is available to both Number and Tally Attributes.
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.
This example uses a "Lifetime Orders" Timeline that captures the Order Total values. All entries in the Timeline count towards the Rolling Average, essentially making it a simple Average. The Enrichment keeps the average updated to account for new Timeline entries.
|Timeline Attribute: "Lifetime Orders"|
|Entries||Order Total ($)|
|(Rolling) Average is (10.00 + 20.00 + 30.00 + 40.00 + 50.00) ÷ 5 = 30.00|
This example uses a "90-day Orders" Timeline, which uses a 90 day expiration, so only entries captured in the last 90 days will be considered for the Enrichment. 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.
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 ($)|
|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 $)|
|Valid Entries||Order Total (in $)|
|Rolling Average is (20.00 + 30.00 + 40.00) ÷ 3 = 30.00|
1. Add a new Metric Attribute or a Tally Attribute. This Attribute will store the resulting average.
2. Give it a Title and set its Scope.
3. Click on Add Enrichment and select Set Rolling Average Based On Timeline.
4. From the first dropdown, select the Attribute that has the values you want to average out.
5. From the next dropdown, select the Timeline where the Attributed is being captured.
6. Click Finish to confirm. Then Save/Publish the changes in your profile.
In this example, you will learn how to record a Timeline of order confirmation events that have occurred in the last 90 days and, at the same time, capture the resulting order total values. Then you will create a new Metric along with the Rolling Average Enrichment to average out the order totals.
STEP 1: Create "Order Total" as a new Metric Attribute.
Purpose: To store the order total values from the receipt page.
Title: Order Total Scope: Current Visit Enrichment: Set this Metric to "order_total" WHEN: ANY_PAGE_EVENT Attach or Create Rule: Current URL CONTAINS "receipt.html"
STEP 2: Create "90-Day Order Timeline" as a Timeline Attribute with a 90 day expiration.
Purpose: To record every order confirmation event on the receipt page and capture the numerical order total values.
Title: 90-day Order Timeline Scope: Visitor
Entry: Update Timeline Capture Attribute Data: Order Total WHEN: ANY_PAGE_EVENT Attach or Create Rule Condition: Current URL contains "receipt.html"
Entry: Set Expiration of Timeline events Set each event in this Timeline to expire after "90" days
STEP 3: Create "90-Day Order Average" as a new Metric Attribute with the Set Rolling Average Based on Timeline Enrichment.
Purpose: To store the average value of orders from the last 90 days.
Title: 90-day Order Average Scope: Visitor Enrichment: Set Rolling Average based on Timeline Set this Metric to the Rolling Average of Metric "Order Total" captured in timeline "90-day Order Timeline"
Go to API Sampler in your profile and submit a query to find out how many entries were logged into the Timeline and also to determine the final average.
Look for the Title you assigned to the Metric/Tally and the Timeline Attribute.
Assuming there are two entries in the 90-day Order Timeline, the API Sampler will display the results like so:
Similarly, here's the final average stored in the 90-day Order Average Metric:
Copyright All Rights Reserved © 2008-2023