/**
  * Update the analytics data by applying new aggregations
  *
  * @return int the status of the action execution. 0 means normal, other values mean abnormal.
  * @throws \yii\console\Exception
  */
 public function actionAggregate()
 {
     try {
         Analytics::aggregate();
     } catch (\Exception $e) {
         throw new Exception($e->getMessage());
     }
     $this->stdout(gmdate('Y-m-d H:i:s') . ' : ' . Yii::t('app', "Analytics has successfully updated the stats tables.") . "\n", Console::FG_GREEN);
     return self::EXIT_CODE_NORMAL;
 }
 /**
  * Show form submissions stats in csv format
  *
  * @param $id
  */
 public function actionStats($id)
 {
     // Analytics Report
     $report = Analytics::report();
     // Set params
     $report->app($id)->report('submissions')->prepare()->performAsCSV();
 }
 /**
  * Track a hit and display a transparent 1x1px gif
  *
  * @return string
  * @throws \Exception
  */
 public function actionI()
 {
     try {
         // Analytics collect data requests from the trackers in the GET or POST form,
         // and write it to logs.
         Analytics::collect();
     } catch (\Exception $e) {
         if (defined('YII_DEBUG') && YII_DEBUG) {
             throw $e;
             // Enable in debug
         }
     }
     return $this->getTransparentGif();
 }