Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards

How to calculate the time duration between user logs in and log out using calculated metrics?

Avatar

Level 1

Hi,

I want to create a calculated metrics to calculate exact time duration between when user logs in and log out.

I have used the formula like 

Total time spent/visits

 

Is this correct? pls can anyone help me on this

2 Replies

Avatar

Community Advisor and Adobe Champion

Hi @ESS_DigitalWe 

this does not work out of the box in Adobe Analytics (in CJA you would have Date Math these days), 

you will need a plugin and a custom implementation for this: https://experienceleague.adobe.com/en/docs/analytics/implementation/vars/plugins/gettimebetweenevent... 

 

Note that this is a client-side measurement approach and not a Workspace feature.

Cheers from Switzerland!


Avatar

Community Advisor and Adobe Champion

I agree, this will really just average the time spent in a slightly different way... however, you should be aware that the last page in a visit in most cases won't be included in any time metrics... as there is no clear event to indicate that the user has finished using the site.

 

This is also going to be an issue trying to track this yourself...  The getTimeBetweenEvents is good if you can clearly define the start and end events... which may not be the case here.... 

 

 

The definition of a calculated metric technically already exists (sort of), out of the box in Adobe...

Average Time on Site

 

The problem is that this definition changes depending on the usage... when used against the "Day" dimension, it will return the average time spend on the site in that day, but that might include multiple visits by the visitor.... Your specific definition will keep that limited to Visit, and certainly can be used.

 

You can see it's very different at the Day level:

Jennifer_Dungan_2-1763995791147.png

 

But, if I were to breakdown by my Users and Visit Number:

Jennifer_Dungan_1-1763995621167.png

 

You can see that the calculated metric is basically spot on...

 


So, yes, you should be able to use that calculation for a simple way to get the average time spent per Visit.

 

While Adobe's time spent isn't the best (due to it not being a heartbeat system, and not taking into account tabs in the background or the last page)... as a benchmarking metric, it has value, and watching specifically at the Visit level is certainly worth monitoring.