コード例 #1
0
ファイル: VisitorRecognizer.php プロジェクト: piwik/piwik
 /**
  * @return array
  */
 private function getVisitFieldsPersist()
 {
     if (is_null($this->visitFieldsToSelect)) {
         $fields = array('idvisitor', 'idvisit', 'user_id', 'visit_exit_idaction_url', 'visit_exit_idaction_name', 'visitor_returning', 'visitor_days_since_first', 'visitor_days_since_order', 'visitor_count_visits', 'visit_goal_buyer', 'location_country', 'location_region', 'location_city', 'location_latitude', 'location_longitude', 'referer_name', 'referer_keyword', 'referer_type');
         $dimensions = VisitDimension::getAllDimensions();
         foreach ($dimensions as $dimension) {
             if ($dimension->hasImplementedEvent('onExistingVisit') || $dimension->hasImplementedEvent('onAnyGoalConversion')) {
                 $fields[] = $dimension->getColumnName();
             }
             foreach ($dimension->getRequiredVisitFields() as $field) {
                 $fields[] = $field;
             }
         }
         /**
          * This event collects a list of [visit entity](/guides/persistence-and-the-mysql-backend#visits) properties that should be loaded when reading
          * the existing visit. Properties that appear in this list will be available in other tracking
          * events such as 'onExistingVisit'.
          *
          * Plugins can use this event to load additional visit entity properties for later use during tracking.
          *
          * This event is deprecated, use [Dimensions](http://developer.piwik.org/guides/dimensions) instead.
          *
          * @deprecated
          */
         $this->eventDispatcher->postEvent('Tracker.getVisitFieldsToPersist', array(&$fields));
         array_unshift($fields, 'visit_first_action_time');
         array_unshift($fields, 'visit_last_action_time');
         for ($index = 1; $index <= CustomVariables::getNumUsableCustomVariables(); $index++) {
             $fields[] = 'custom_var_k' . $index;
             $fields[] = 'custom_var_v' . $index;
         }
         $this->visitFieldsToSelect = array_unique($fields);
     }
     return $this->visitFieldsToSelect;
 }
コード例 #2
0
 public function afterRequestProcessed(VisitProperties $visitProperties, Request $request)
 {
     $ip = $visitProperties->getProperty('location_ip');
     /**
      * Triggered after visits are tested for exclusion so plugins can modify the IP address
      * persisted with a visit.
      *
      * This event is primarily used by the **PrivacyManager** plugin to anonymize IP addresses.
      *
      * @param string &$ip The visitor's IP address.
      */
     $this->eventDispatcher->postEvent('Tracker.setVisitorIp', array(&$ip));
     $visitProperties->setProperty('location_ip', $ip);
 }