Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Handling exceptions in (getDaysSinceLastVisit and getNewRepeat functions)


Level 1




I measured, that about in 0,1% of pageviews crashes the function call of s.c_r in getDaysSinceLastVisit and getNewRepeat functions because it returns undefined value. When in next comand if reference to cval.length, it cancells the javascript execution.

It can be fixed in s.c_r funtion itself - the best solution. Or it can be patched by modification of plugins itself (add bold and italic signed part):



 *  Plugin: Days since last Visit v1.1


  1. getDaysSinceLastVisit=new Function("c",""

+"var s=this,e=new Date(),es=new Date(),cval,cval_s,cval_ss,ct=e.getT"


+"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(typeof(cval)==='undefined'){re"

+"turn f0};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 && d>7*day"

+"){s.c_w(c,ct,e);s.c_w(c+'_s',f3,es);}else if(d<7*day+1 && d>day){s."

+"c_w(c,ct,e);s.c_w(c+'_s',f4,es);}else if(d



+"ed'){return f0};if(cval_s.length==0) retur"

+"n f0;else if(cval_s!=f1&&cval_s!=f2&&cval_s!=f3&&cval_s!=f4&&cval_s"

+"!=f5) return '';else return cval_s;");