getPreviousValue SiteCatalyst Plug-in

The getPreviousValue plug-in captures the value from the previous page and records it on the current page.

Plug-in Prototype
s.getPreviousValue(v,c,e);

Parameter Descriptions
v = variable to be captured from the previous page.
c = cookie name for use in storing the value.
e = events which must be set on the page view in order to trigger the retrieval of the previous value. When omitted, the plug-in will capture the previous value on all page views.

Example
Here is how to capture the page name value of the previous page into prop1 when event 1 is set on the current page.

s.getPreviousValue(s.pageName,'gpv_pn','event1');

Code

/*
 * Plugin: getPreviousValue_v1.0 - return previous value of designated
 * variable (requires split utility)
 */
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}");