Expand my Community achievements bar.

Join us at Adobe Summit 2024 for the Coffee Break Q&A Live series, a unique opportunity to network with and learn from expert users, the Adobe product team, and Adobe partners in a small group, 30 minute AMA conversations.
SOLVED

Average time between 2 suces events

Avatar

Level 8

Hello Adobe Community,

I've been asked to mesure the average time between 2 different events on unique visitors ( so first event can happen in visit number x, and second event on another separeted visit ).

How can this be done ? There was a document on a Time To Complete Plug-in , but without any explanation.

Kind regards,


Cheers,

Mario

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

marion33678522​ btw: if you are using the adobe moblie sdk‘s, there is a function specially for this:

iOS: Timed Actions

Android: Timed Actions

you could just hand over the desired events and links above to the devs, should be straight forward ...

View solution in original post

8 Replies

Avatar

Community Advisor

there is a documentation about the time parting plugin, i guess that‘s what you need: getTimeParting

Avatar

Community Advisor

Dear Mario,

Include the plugin and add the below codes in s_doPlugins section.

>>Code Start<<

if (s.events && (s.events + ",").indexOf("event1,") > -1) {

s.prop1 = "start"

}

if (s.events && (s.events + ",").indexOf("event2,") > -1) {

s.prop1 = "stop"

}

s.prop1 = s.getTimeToComplete(s.prop1, "TTC", 0);

>>Code End<<

Plugin:

>>Code Start<<

s.getTimeToComplete = new Function("v", "cn", "e", "var s=this,d=new Date,x=d,k;if(!s.ttcr){e=e?e:0;if(v=='start'||v=='stop')s.ttcr=1;x.setTime(x.getTime()+e*86400000);if(v=='start'){s.c_w(cn,d.getTime(),e?x:0);return '';}if(v=='stop'){k=s.c_r(cn);if(!s.c_w(cn,'',d)||!k)return '';v=(d.getTime()-k)/1000;var td=86400,th=3600,tm=60,r=5,u,un;if(v>td){u=td;un='days';}else if(v>th){u=th;un='hours';}else if(v>tm){r=2;u=tm;un='minutes';}else{r=.2;u=1;un='seconds';}v=v*r/u;return (Math.round(v)/r)+' '+un;}}return '';");

>>Code End<<

If the implementation requires any other plugin support, include them as well.

Note that the value will be visible only in the 2nd image request i.e. After 2nd event occurs.

Thank You

Arun

Avatar

Level 8

Thanks alot PratheepArunRaj​ ;


I'll try this,

But do you know if this also works for 2 different sessions on an app (Before I go to my sdk teams and implement a new app build ).

Kind regards,


And cheers,


Mario


Mar

Avatar

Level 8

Hello urs.boller

PratheepArunRaj​ is advising in using s.getTimeToComplete to the s_doPlugin.

Which one is better ?

s.getTomeParting or s.getTimeToComplete ?

Kind regards !

Avatar

Community Advisor

hi mario

the solution written by PratheepArunRaj​ is really short, would try to go with that.

btw: i don‘t think this will work with a mobile sdk. but you can ask the developpers to do same:

1) save timestamp on first action

2) save timestamp on second action

3) calculate difference 2)-1) and send data to analytics

4) save data to prop/evar in analytics backend

Avatar

Level 8

Hello urs.boller​ ,

I kind of get it, and please correct me if I'm wrong - this won't be feasible for timestamps on 2 diferent visits ?

Kind regards,

Avatar

Community Advisor

marion33678522

don‘t know, but there could be a way to store the first timedstamp within the app for a longer time (so it is available at the second event)

just to make sure: doing this, you will only get ONE analytics call with a time information. therefore it does not depend on “visits in analytics“ but on the framework collecting the information (eg. app).

Avatar

Correct answer by
Community Advisor

marion33678522​ btw: if you are using the adobe moblie sdk‘s, there is a function specially for this:

iOS: Timed Actions

Android: Timed Actions

you could just hand over the desired events and links above to the devs, should be straight forward ...