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:

  • Only Date Attributes are available to this Enrichment.
  • The Enrichment calculates the absolute difference of the dates, which means the resulting Number is always non-negative.
  • Elapsed time can be expressed in one of the following:
    • Minutes
    • Hours
    • Days
    • Weeks
    • Months

Add and Configure the Enrichment

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.

    • New Visitor: Enrichment will occur when the visitor is new to your site.
    • New Visit: Enrichment will occur on a new visit by a visitor.
    • Any page event: Enrichment will occur anytime a page event occurs. If you're not certain which selection to make, choose this one.
    • Visit ended: Enrichment will occur when a visit ends.

6. Attach an existing Rule or create a new Rule for additional triggers.

7. Save the settings and Save/Publish the changes.

Usage Example

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.