getAndPersistValue SiteCatalyst Plug-in

This plug-in allows you to set a variable on one page of a visit, and then carry that variable to each additional page view. It will write a value to the cookie ‘c’ and return the value. The cookie expires after ‘e’ days (0 for session). If there is no new value, it will return the value from the cookie ‘c’.

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

Parameter Descriptions
v=Value to write in cookie and return
c=Cookie Name ‐ something like ‘s_cp_persist’
e=Number of days to expiration ‐ 0 for session

Example
Here is an example use of the plug-in to take the value of s.eVar1 and place that value in the same variable on each additional page view.

s.eVar1=s.getAndPersistValue(s.eVar1,'s_evar1_per',0);

Code

/*
 * Plugin: getAndPersistValue 0.3 - get a value on every page
 */
s.getAndPersistValue=new Function("v","c","e",""
+"var s=this,a=new Date;e=e?e:0;a.setTime(a.getTime()+e*86400000);if("
+"v)s.c_w(c,v,e?a:0);return s.c_r(c);");