Adobe Analytics Plugin On 
              getTimeBetweenEvents
Self

Adobe Analytics Plugin On getTimeBetweenEvents

Adobe kindly offers us sophisticated solutions to maximize the use of Adobe Analytics. Adobe Consulting provides many refined plug-ins, one among them is GetTimeBetweenEvents which is the subject of this article because it is the least frequently used plug-in, but if we are aware of its present usage, we can explore all of its potential use cases.

With the help of the getTimeBetweenEvents plugin, you can monitor the interval between any two Analytics events, including custom and shopping cart events. It is helpful for keeping note of the length of time it takes to finish a checkout process or any other process you want to measure time for. If you don't want to track the duration of any conversion procedures, you don't need this plug-in.

There are numerous use cases to use this plugin, but one frequent application is to measure time between user arriving on product detailed page (PDP) and a confirmation page.  Here's how you guarantee a high-fidelity signal and a reliable, stable plugin implementation to enable data flow to Adobe Analytics.

function getTimeBetweenEvents(ste,rt,stp,res,cn,etd,fmt,bml,rte)

The time between the start timer event and the stop timer event is represented as an integer in the chosen format when this function is called.

The function uses required and optional parameters.

Required parameters

ste (data type: string): An Analytics event to “start the timer”.

  • Example: = "scAdd"

rt (data type is boolean): If you want the timer to restart each time the events variable includes a start timer event, set the value to true. If you don't want the timer to restart when it detects a start timer event, set the value to false. Essentially, used to restart timer.

  • Example = set equal to false, this means only the first instance of s.events containing "scAdd" event will start the timer.

stp (data type: string): An Analytics event to “stop the timer”.

  • Example: "purchase"

res (data type: Boolean): Timer reset option. If you wish to reset the timer once it stops and record the time since the timer began, set the value to true. If you wish to record the time but keep the timer running, set false. When the events variable records a stop event, the timer stops if false is set. Essentially, used to reset option.

  • Example: "true" Set to true if you want to record the time since the timer started AND reset the timer after it stops.

Optional parameters

cn (data type: string): The name of the cookie where the time of the first event is stored, by default cookie name is "s_tbe".

  • Example: ""

etd (data type: integer): The expiration time for the cookie in days. Set to 0 to expire at the end of the browser session. Defaults to 1 day when not set

  • Example: 0; set to 0 to expire at the end of the browser session.

fmt (data type:  string): The format of the time that the number of seconds is returned in: “s” for seconds, “m” for minutes, “h” for hours and “d” for days

  • Example: "m" - The format of the time that the number of minutes is returned.

The following guidelines govern the format of return values when they are not set:

  1.  Anything less than a minute is rounded to the closest 5-second benchmark.
  2. Anything between a minute and an hour is rounded to the closest 1/2-minute benchmark.
  3. Anything between an hour and a day is rounded to the closest quarter-hour benchmark.
  4. Anything greater than a day is rounded to the closest day benchmark.

bml (data type:  number): The length of the rounding benchmark in the fmt argument's specified format. For instance, the return result is rounded to the nearest 2-second benchmark if the fmt parameter is "s" and this argument is 2. When this parameter is 0.5 and the fmt argument is "m," the return value is rounded to the nearest benchmark time of a half-minute.

  • Example:  0.5 ; the return value is rounded to the closest half-minute benchmark.

rte (data type: string): An Analytics events that remove or delete the timer.

  • Example: ""

Syntax

If you enjoy using this plugin, keep note of the interval between two regular occurrences to determine when the conversion will take place. This should be the getTimeBetweenEvents plugin's syntax

eVarN = s.getTimeBetweenEvents("scAdd", false, "purchase", true, "", 0, "m", 0.5, "");

  • The timer starts or restarts when the events variable contains scAdd (on the Product Details Page).
  • The timer stops and resets when the events variable contains a purchase (on Thank or Confirmation Page).
  • Rounding to the closest 2-second benchmark, eVarN(time between events) represents the duration in seconds between scAdd and purchase.

Final Results

After the implementation is complete, the data in Adobe Analytics report looks like this:

No alt text provided for this image
Results of the plugin

References:

  • https://experienceleague.adobe.com/docs/analytics/implementation/vars/plugins/gettimebetweenevents.html?lang=en


The article is co-authored by Oshu Kapil  

How do we call the function after initialisation? I used the plugin code in adobe analytics extendion custom code and set evar in rule s.tl but it’s not working.

Like
Reply

To view or add a comment, sign in

More articles by Sainath Revankar

Others also viewed

Explore content categories