Exemple #1
0
 /**
  * Map tracker params to model properties
  *
  * @param Event $event
  */
 public function map(Event $event)
 {
     $data = $event->getData();
     $newData = array();
     foreach ($data as $key => $value) {
         $newData[$this->properties[$key]] = $value;
     }
     $this->data = $newData;
 }
 /**
  * Collect data from an Event
  *
  * @param Event $event
  */
 protected function collect(Event $event)
 {
     // if event doesn't have data
     if ($event->isEmpty()) {
         throw new InvalidParamException(Yii::t("app", "The event has no data. There is nothing to collect."));
     }
     // Map tracker params to model properties
     $mapper = new Mapper();
     $mapper->map($event);
     // Mapped data
     $data = $mapper->getData();
     // Add collector data
     $data["collector_tstamp"] = time();
     // Unix Timestamp for the event recorded by the collector
     $data["v_collector"] = "1.0";
     // Collector version
     $this->data = $data;
 }
Exemple #3
0
 /**
  * Detect if this session should be excluded.
  *
  * @return bool
  */
 protected function shouldBeExcluded()
 {
     $excluded = false;
     if ($this->hit->isBot()) {
         $excluded = true;
         Yii::info(Yii::t("app", "SearchBot detected."));
     } elseif (!$this->hit->shouldBeRecorded()) {
         $excluded = true;
         Yii::info(Yii::t("app", "The parameter 'rec' was not found in the request."));
     } elseif ($this->hit->hasIgnoreCookie()) {
         $excluded = true;
         Yii::info(Yii::t("app", "The ignore cookie was found."));
     } elseif ($this->hit->hasPrefetchRequest()) {
         $excluded = true;
         Yii::info(Yii::t("app", "Prefetch request detected."));
     } elseif ($this->hit->hasReferrerSpam()) {
         $excluded = true;
         Yii::info(Yii::t("app", "Referrer URL is a known spam."));
     } elseif ($this->wasExcludedByIpAddress()) {
         $excluded = true;
         Yii::info("app", "The ip is in the exluded list for this form.");
     } elseif ($this->wasExcludedByUserAgent()) {
         $excluded = true;
         Yii::info(Yii::t("app", "The user agent is in the excluded list for this form."));
     }
     return $excluded;
 }