var retailrocket = window["retailrocket"] || {};
 
retailrocket.segmentator = (function () {  
  var visitorSegmenRecordCookieName = "rr-VisitorSegment";
  
  var rrLibrary = {  
    getCookie: function (cName) {  
      var i, x, y, arRcookies = document.cookie.split(";");  
      for (i = 0; i < arRcookies.length; i++) {  
        x = arRcookies[i].substr(0, arRcookies[i].indexOf("="));  
        y = arRcookies[i].substr(arRcookies[i].indexOf("=") + 1);  
        x = x.replace(/^\s+|\s+$/g, "");  
        if (x == cName) {  
          return unescape(y);  
        }  
      }  
      return null;  
    },  
    daysToSecond: function (days) {  
      return days * 24 * 60 * 60;  
    },  
    setCookie: function (cName, value, expireInSecond, path) {  
      var exdate = new Date();  
      exdate.setSeconds(exdate.getSeconds() + expireInSecond);  
      var cValue = escape(value) + ((expireInSecond == null) ? "" : "; expires=" + exdate.toUTCString()) + (";path=" + (path || "/"));  
      document.cookie = cName + "=" + cValue;  
    }  
  };  
    
  return {  
    getVisitorSegment: function (nSegment, option) {  
      option = option || {};
      var visitorSegmentRecord = rrLibrary.getCookie(visitorSegmenRecordCookieName);
        
      if (!visitorSegmentRecord || visitorSegmentRecord.split(":")[0] != nSegment) {  
        visitorSegmentRecord = nSegment + ":" + ((Math.round(new Date().getTime() / 1000)) % nSegment); 
      }  
        
      rrLibrary.setCookie(visitorSegmenRecordCookieName, visitorSegmentRecord, rrLibrary.daysToSecond(option.expireInDay || 60), "/");  
      return visitorSegmentRecord.split(":")[1];  
    }  
  };  
}());  

@@ -42,17 +42,16 @@
  %7C%7C %7B%7D;%0A
- 
 %0Aretailr
@@ -84,19 +84,19 @@
 ion () %7B
+%0A
   
-%0A
   var vi
@@ -146,19 +146,19 @@
 gment%22;%0A
+%0A
   
-%0A
   var rr
@@ -168,19 +168,21 @@
 rary = %7B
+%0A
   
-%0A
+  
     getC
@@ -202,27 +202,31 @@
 on (cName) %7B
+%0A    
   
-%0A
       var i,
@@ -272,19 +272,23 @@
 it(%22;%22);
+%0A    
   
-%0A
       fo
@@ -326,19 +326,25 @@
 ; i++) %7B
+%0A
   
-%0A
+      
         
@@ -395,27 +395,33 @@
 dexOf(%22=%22));
+%0A      
   
-%0A
         y = 
@@ -473,27 +473,30 @@
 %22) + 1);
+%0A  
   
-%0A
+ 
         
 x = x.re
@@ -483,24 +483,27 @@
             
+   
 x = x.replac
@@ -522,19 +522,25 @@
 /g, %22%22);
+%0A
   
-%0A
+      
         
@@ -556,19 +556,27 @@
 cName) %7B
+%0A        
   
-%0A
         
@@ -596,19 +596,25 @@
 cape(y);
+%0A     
   
-%0A
+ 
         
@@ -618,21 +618,29 @@
    %7D
-  %0A      %7D  %0A
+%0A            %7D%0A      
     
@@ -653,28 +653,32 @@
 rn null;
+%0A
   
-%0A
+  
     %7D,
+%0A
   
-%0A
+  
     days
@@ -704,19 +704,23 @@
 (days) %7B
+%0A   
   
-%0A
+ 
       re
@@ -748,20 +748,24 @@
  60;
+%0A
   
-%0A
+  
     %7D,
+%0A
   
-%0A
+  
     
@@ -822,19 +822,23 @@
  path) %7B
+%0A    
   
-%0A
       va
@@ -859,19 +859,23 @@
  Date();
+%0A    
   
-%0A
       ex
@@ -928,19 +928,23 @@
 Second);
+%0A    
   
-%0A
       va
@@ -1069,25 +1069,29 @@
 %7C %22/%22));
+%0A 
   
-%0A
       
+   
 document
@@ -1125,31 +1125,138 @@
 lue;
-  %0A    %7D  %0A  %7D;  %0A    %0A
+%0A        %7D%0A    %7D;%0A%0A    function randomInt(min, max) %7B%0A        return Math.floor(Math.random() * (max - min + 1)) + min;%0A    %7D;%0A%0A  
   re
@@ -1261,19 +1261,21 @@
 return %7B
+%0A 
   
-%0A
+ 
     getV
@@ -1318,19 +1318,23 @@
 ption) %7B
+%0A    
   
-%0A
       op
@@ -1356,24 +1356,30 @@
 %7C %7B%7D;%0A      
+  
+    
 var visitorS
@@ -1445,24 +1445,25 @@
 eName);%0A
+%0A
         
 %0A      i
@@ -1454,23 +1454,20 @@
         
-%0A
     
-  
 if (!vis
@@ -1536,19 +1536,25 @@
 gment) %7B
+%0A      
   
-%0A
         
@@ -1597,52 +1597,20 @@
 %22 + 
-((Math.round(new Date().getTime() / 1000)) %25
+randomInt(1,
  nSe
@@ -1620,29 +1620,30 @@
 nt);
- 
 %0A      
-%7D
   
-%0A
     
+%7D%0A%0A
     
-%0A
+  
     
@@ -1772,19 +1772,23 @@
 ), %22/%22);
+%0A    
   
-%0A
       re
@@ -1831,30 +1831,28 @@
 %5B1%5D;
-  
 %0A    
-%7D
+  
   
+%7D
 %0A  
-%7D;
   
+%7D;
 %0A%7D());
-  
 %0A

Update retailrocket.segmentator.js