Description: Calculates the elapsed time between two events with unique timestamps.
Example: Days elapsed since the last purchase made by a visitor. (Usage Example below).
Things to Remember:
1. Add a new Number Attribute. Give it a Title and select its Scope. The Notes field is optional but recommended.
2. Click on 'Create an Enrichment' and select "Set Difference Between Two Dates".
3. Select a Date attribute from each of the two Attribute dropdowns. It is NOT required to select them in a chronological order.
4. Select a unit of measurement. The default is 'Minutes' but you can change it to Hours, Days, Weeks, or Months.
5. Select a trigger from the WHEN dropdown.
6. Attach an existing Rule or create a new Rule for additional triggers.
7. Save the settings and Save/Publish the changes.
Here, you will learn how to calculate the days elapsed since a visitor last purchased anything on your site. You will configure the Enrichment to deduct the date of last purchase from the date of current visit. Remember, the chronology of dates is not important because the difference is always absolute.
Step 1: Add a new Date attribute. Create the 'Capture Date' Enrichment to capture the timestamp whenever the visitor lands on the order completion page.
Title: Last Purchase Date Scope: Visitor WHEN: Any page event Attach/Create Rule: Current URL contains (ignore case) "receipt.html"
Step 2: Add a new Number Attribute and create this Enrichment.
Select 'Visit Start' Date (preloaded Attribute) and the Last Purchase Date (see Step 1) from the two dropdowns.
Title: Days Since Last Purchase Scope: Visitor Date Attribute in first drop-down: Visit Start Date Attribute in second drop-down: Last Purchase Date Difference in: Days WHEN: New Visit
Step 3: Save the settings. Then Save/Publish your profile.
When the Enrichment runs, it will deduct the date of "Visit Start" from the date of 'Last Purchase'. The difefrence Number can be leveraged in Rules, Audiences and other Attributes for taking suitable action on habitual and occasional visitors.