Average time between 2 suces events | Community
Skip to main content
marion33678522
February 16, 2018
Solved

Average time between 2 suces events

  • February 16, 2018
  • 8 replies
  • 5327 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Urs_Boller

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 ...

8 replies

Urs_Boller
Community Advisor
Community Advisor
February 16, 2018

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

PratheepArunRaj
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
February 17, 2018

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

Thank You, Pratheep Arun Raj B (Arun) | Xerago | Terryn Winter Analytics
marion33678522
February 19, 2018

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

marion33678522
February 19, 2018

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 !

Urs_Boller
Community Advisor
Community Advisor
February 19, 2018

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

marion33678522
February 22, 2018

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,

Urs_Boller
Community Advisor
Community Advisor
February 22, 2018

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).

Urs_Boller
Community Advisor
Urs_BollerCommunity AdvisorAccepted solution
Community Advisor
February 22, 2018

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 ...