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)

Avatar

Avatar
Boost 1
Level 1
RaStan
Level 1

Like

1 like

Total Posts

1 post

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
RaStan
Level 1

Like

1 like

Total Posts

1 post

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
RaStan
Level 1

15-10-2014

Hello,

 

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"

+"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(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

+"_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(typeof(cval)==='undefin"

+"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;");