Measuring Time Spent | Adobe SiteCatalyst

Looking at time spent on site/particular pages is a great first step from the provided out of the box functionality that Omniture SiteCatalyst provides.  But what if you wanted to see the exact time spent (i.e. 2 min and 22 seconds) versus either the canned grouping that the site content -> time spent report displays or the average time spent (via metrics brought into reports)?

With SiteCatalyst out of the box, this can’t be done.  However, leveraging two plugins that can be obtained via Omniture Engineering (getTimeToComplete and getPreviousValue), one could begin to get at this data.  Adding in an additional plugin (exitLinkHandler) you can, from start to exit, measure what’s going on.Below is an example of how to do this as well as what it will look like when its completed.

What you will need:

  • getTimeToComplete plugin
  • getPreviousValue plugin
  • exitLinkHandler plugin
  • two (2) success events – for tracking the getTimeToComplete
  • one (1)  s.props – for holding the time it took

Since the getTimeToComplete plugin requires two success events to be fired before it can then take the time from each to calculate the time to complete (in this case time spent on page), we need to also leverage the getPreviousValue plugin to accurately track this initiative.

Logic:

1. Add the following lines of code to the s_code.js file (right after the doPlugins start)

/* Plugin: Get Granular Time Spent on Previous Page v.1.0 */s.events=s.apl(s.events, 'event1', ',', 1); //to flag page viewif(s.events.indexOf('event1')>-1)s.prop1='start';var x = s.getPreviousValue(s.pageName,"s_pv");var y = s.exitLinkHandler();if (x){s.events=s.apl(s.events, 'event2', ',', 1); //to flag a previous page}if (x || y){if(s.events.indexOf('event2')>-1)s.prop1='stop';s.prop1=s.getTimeToComplete(s.prop1,'ttc',0);}if (y){s.prop1='stop';s.prop1=s.getTimeToComplete(s.prop1,'ttc',0);}

2. Add the following lines of code below the doPlugins() function call and above the DO NOT ALTER CODE LINE)

/* Plugin: Get Granular Time Spent on Previous Page v.1.0 - requires s.apl function */s.getPreviousValue=new Function("v","c","el",""+"var s=this,t=new Date,i,j,r='';t.setTime(t.getTime()+1800000);if(el"+"){if(s.events){i=s.split(el,',');j=s.split(s.events,',');for(x in i"+"){for(y in j){if(i[x]==j[y]){if(s.c_r(c)) r=s.c_r(c);v?s.c_w(c,v,t)"+":s.c_w(c,'no value',t);return r}}}}}else{if(s.c_r(c)) r=s.c_r(c);v?"+"s.c_w(c,v,t):s.c_w(c,'no value',t);return r}");s.exitLinkHandler=new Function("p",""+"var s=this,h=s.p_gh(),n='linkInternalFilters',i,t;if(!h||(s.linkTyp"+"e&&(h||s.linkName)))return '';i=h.indexOf('?');t=s[n];s[n]=p?p:t;h="+"s.linkLeaveQueryString||i<0?h:h.substring(0,i);if(s.lt(h)=='e')s.li"+"nkType='e';else h='';s[n]=t;return h;");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='sec"+"onds';}v=v*r/u;return (Math.round(v)/r)+' '+un;}}return '';");

Once this is in place, you will be able to create a correlation report to see time spent on each page.

Then via SAINT, you can reclassify the data to fall into the predefined buckets I mentioned above (i.e. 1-3 min, 4-6 min, etc).

About these ads

2 thoughts on “Measuring Time Spent | Adobe SiteCatalyst

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s