Beispiel #1
0
 public function hasConversions()
 {
     $this->checkSitePermission();
     $idGoal = Common::getRequestVar('idGoal', '', 'string');
     $idSite = Common::getRequestVar('idSite', null, 'int');
     $period = Common::getRequestVar('period', null, 'string');
     $date = Common::getRequestVar('date', null, 'string');
     Piwik::checkUserHasViewAccess($idSite);
     $conversions = new Conversions();
     Json::sendHeaderJSON();
     $numConversions = $conversions->getConversionForGoal($idGoal, $idSite, $period, $date);
     return json_encode($numConversions > 0);
 }
Beispiel #2
0
 private function isAbandonedCart($fetchIfNotSet)
 {
     $abandonedCarts = Common::getRequestVar('abandonedCarts', '', 'string');
     if ($abandonedCarts === '') {
         if ($fetchIfNotSet) {
             $idSite = Common::getRequestVar('idSite', 0, 'int');
             $period = Common::getRequestVar('period', '', 'string');
             $date = Common::getRequestVar('date', '', 'string');
             $conversion = new Conversions();
             $conversions = $conversion->getConversionForGoal(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER, $idSite, $period, $date);
             $cartNbConversions = $conversion->getConversionForGoal(Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART, $idSite, $period, $date);
             $preloadAbandonedCart = $cartNbConversions !== false && $conversions == 0;
             if ($preloadAbandonedCart) {
                 $abandonedCarts = '1';
             } else {
                 $abandonedCarts = '0';
             }
         } else {
             $abandonedCarts = '0';
         }
     }
     return $abandonedCarts == '1';
 }