Three SiteCatalyst Plugins To Add Detail To Visits

Here are three different plugins that have to do with your site visits. If you have not read it yet, be sure to check out Omniture’s Matt Belkin’s view on visits. It is one of the most important metrics to use, and here are a few plugins that will give you a little more insight to your site’s visits.

1. New/Repeat Visit
This plugin takes a look at each visit and sets the value of either “New” or “Repeat” right in a prop or eVar. One thing about this plugin is that it will set the value on every page view. One thing I recommend is to contact Client Care and have them enable visits for for the prop you plan to use with this plugin. Here is what you should get:
New/Repeat Visit Report

Here is the actual code:

s.prop1=s.getNewRepeat();

/*
 * Plugin: getNewRepeat
 */
s.getNewRepeat=new Function(""
+"var s=this,e=new Date(),cval,ct=e.getTime(),y=e.getYear();e.setTime"
+"(ct+30*24*60*60*1000);cval=s.c_r('s_nr');if(cval.length==0){s.c_w("
+"'s_nr',ct,e);return 'New';}if(cval.length!=0&amp;&amp;ct-cval<30*60*1000){s"
+".c_w('s_nr',ct,e);return 'New';}if(cval<1123916400001){e.setTime(cv"
+"al+30*24*60*60*1000);s.c_w('s_nr',ct,e);return 'Repeat';}else retur"
+"n 'Repeat';");

2. Visit Number
This plugin counts the number of visits that an individual visitor has. This is neat to see how users on their 9th or 10th visit interact with the site, as opposed to their 3rd or 4th visit. The report you will get with this is just a list of numbers, which you can correlate with other traffic items.

Here is the actual code:

s.prop2=s.getVisitNum();

/*
 * Plugin: getVisitNum
 */
s.getVisitNum=new Function("" 
+"var s=this,e=new Date(),cval,cvisit,ct=e.getTime(),c='s_vnum',c2='s" 
+"_invisit';e.setTime(ct+30*24*60*60*1000);cval=s.c_r(c);if(cval){var" 
+" i=cval.indexOf('&amp;vn='),str=cval.substring(i+4,cval.length),k;}cvis" 
+"it=s.c_r(c2);if(cvisit){if(str){e.setTime(ct+30*60*1000);s.c_w(c2,'" 
+"true',e);return str;}else return 'unknown visit number';}else{if(st" 
+"r){str++;k=cval.substring(0,i);e.setTime(k);s.c_w(c,k+'&amp;vn='+str,e)" 
+";e.setTime(ct+30*60*1000);s.c_w(c2,'true',e);return str;}else{s.c_w" 
+"(c,ct+30*24*60*60*1000+'&amp;vn=1',e);e.setTime(ct+30*60*1000);s.c_w(c2" 
+",'true',e);return 1;}}"); 

3. Days Since Last Visit
This report looks at all of your visits, and tells you how long it has been since the previous visit. As with the previous two, this is going to be set on every page of the site, so make sure you enable visits. Here is what the report would look like:
Days Since Last Visit Report
As you can see it takes each visit and categorizes each one as being First Visit, Less than 1 day, Less than 7 days, More than 7 days, and More than 30 days.

Here is the actual code:

s.prop3=s.getDaysSinceLastVisit('s_lv');

/*
 * Plugin: Days since last Visit
 */
s.getDaysSinceLastVisit=new Function("c",""
+"var s=this,e=new Date(),es=new Date(),cval,cval_s,cval_ss,ct=e.getT"
+"ime(),day=24*60*60*1000,f1,f2,f3,f4,f5;e.setTime(ct+3*365*day);es.s"
+"etTime(ct+30*60*1000);f0='Cookies Not Supported';f1='First Visit';f"
+"2='More than 30 days';f3='More than 7 days';f4='Less than 7 days';f"
+"5='Less than 1 day';cval=s.c_r(c);if(cval.length==0){s.c_w(c,ct,e);"
+"s.c_w(c+'_s',f1,es);}else{var d=ct-cval;if(d>30*60*1000){if(d>30*da"
+"y){s.c_w(c,ct,e);s.c_w(c+'_s',f2,es);}else if(d<30*day+1 &amp;&amp; d>7*day"
+"){s.c_w(c,ct,e);s.c_w(c+'_s',f3,es);}else if(d<7*day+1 &amp;&amp; d>day){s."
+"c_w(c,ct,e);s.c_w(c+'_s',f4,es);}else if(d<day+1){s.c_w(c,ct,e);s.c"
+"_w(c+'_s',f5,es);}}else{s.c_w(c,ct,e);cval_ss=s.c_r(c+'_s');s.c_w(c"
+"+'_s',cval_ss,es);}}cval_s=s.c_r(c+'_s');if(cval_s.length==0) retur"
+"n f0;else if(cval_s!=f1&amp;&amp;cval_s!=f2&amp;&amp;cval_s!=f3&amp;&amp;cval_s!=f4&amp;&amp;cval_s"
+"!=f5) return '';else return cval_s;");

Any of these can also be used to populate an eVar, and you can use them with the getValOnce plugin to grab each value one time per visit, then you can use these in conjunction with any of your success events to give you a greater insight on your site’s visits.

Please consult Client Care before using any of these to see if they are a good fit for your site and what you are trying to accomplish with your analytics investment.

Leave a Reply