Example #1
0
 public function getWhiteLabelId()
 {
     if (ViewsTrack::isDev()) {
         return 3;
     }
     return parent::getWhiteLabelId();
 }
Example #2
0
 public static function getAvgTimeOnPage()
 {
     $timeOnPage = 1;
     $currentTime = time();
     if (isset($_COOKIE['p_time']) && $_COOKIE['p_time'] != '') {
         $lastTime = $_COOKIE['p_time'];
         $timeOnPage = $currentTime - $lastTime;
     }
     // save new time to cookie
     $cookieDomain = ViewsTrack::getCookieDomain();
     $success = setcookie("p_time", $currentTime, time() + 60 * 30, "/", $cookieDomain);
     // 30 minutes expiration
     if (ViewsTrack::isDev()) {
         // I cannot use cookie domain on localhost, simuate without domain
         $success = false;
     }
     if (!$success) {
         // try it again without cookie domain
         $success = setcookie("p_time", $currentTime, time() + 60 * 30, "/");
         // 30 minutes expiration
     }
     return $timeOnPage;
 }