protected function configureSegments()
 {
     $idSite = Common::getRequestVar('idSite', 0, 'int');
     if (empty($idSite)) {
         return array();
     }
     $configuration = StaticContainer::get('Piwik\\Plugins\\CustomDimensions\\Dao\\Configuration');
     $dimensions = $configuration->getCustomDimensionsForSite($idSite);
     foreach ($dimensions as $dimension) {
         if (!$dimension['active']) {
             continue;
         }
         $segment = new Segment();
         $segment->setSegment(CustomDimensionsRequestProcessor::buildCustomDimensionTrackingApiName($dimension));
         $segment->setType(Segment::TYPE_DIMENSION);
         $segment->setName($dimension['name']);
         $columnName = LogTable::buildCustomDimensionColumnName($dimension);
         if ($dimension['scope'] === CustomDimensions::SCOPE_ACTION) {
             $segment->setSqlSegment('log_link_visit_action. ' . $columnName);
             $segment->setCategory('General_Actions');
             $segment->setSuggestedValuesCallback(function ($idSite, $maxValuesToReturn) use($dimension) {
                 $autoSuggest = new AutoSuggest();
                 return $autoSuggest->getMostUsedActionDimensionValues($dimension, $idSite, $maxValuesToReturn);
             });
         } elseif ($dimension['scope'] === CustomDimensions::SCOPE_VISIT) {
             $segment->setSqlSegment('log_visit. ' . $columnName);
             $segment->setCategory('General_Visit');
         } else {
             continue;
         }
         $this->addSegment($segment);
     }
 }
 /**
  * By defining one or multiple segments a user will be able to filter their visitors by this column. For instance
  * show all actions only considering users having more than 10 achievement points. If you do not want to define a
  * segment for this dimension just remove the column.
  */
 protected function configureSegments()
 {
     $segment = new Segment();
     $segment->setSegment('keywords');
     $segment->setCategory('General_Actions');
     $segment->setName('ExampleTracker_DimensionName');
     $segment->setAcceptedValues('Here you should explain which values are accepted/useful: Any word, for instance MyKeyword1, MyKeyword2');
     $this->addSegment($segment);
 }
 /**
  * By defining one or multiple segments a user will be able to filter their visitors by this column. For instance
  * show all reports only considering users having more than 10 achievement points. If you do not want to define a
  * segment for this dimension just remove the column.
  */
 protected function configureSegments()
 {
     $segment = new Segment();
     $segment->setSegment('achievementPoints');
     $segment->setCategory('General_Visit');
     $segment->setName('ExampleTracker_DimensionName');
     $segment->setAcceptedValues('Here you should explain which values are accepted/useful: Any number, for instance 1, 2, 3 , 99');
     $this->addSegment($segment);
 }
 /**
  * By defining one or multiple segments a user will be able to filter their visitors by this column. For instance
  * show all reports only considering users having more than 10 achievement points. If you do not want to define a
  * segment for this dimension just remove the column.
  */
 protected function configureSegments()
 {
     $segment = new Segment();
     $segment->setSegment('last_name');
     $segment->setCategory('General_Visit');
     $segment->setName('ClientCertificates_LastName');
     $segment->setAcceptedValues('Here you should explain which values are accepted/useful: Any number, for instance 1, 2, 3 , 99');
     $this->addSegment($segment);
 }
示例#5
0
 protected function configureSegments()
 {
     $segment = new Segment();
     $segment->setSegment('provider');
     $segment->setCategory('Visit Location');
     $segment->setName('Provider_ColumnProvider');
     $segment->setAcceptedValues('comcast.net, proxad.net, etc.');
     $this->addSegment($segment);
 }
示例#6
0
 protected function configureSegments()
 {
     $segment = new Segment();
     $segment->setCategory('General_Visit');
     $segment->setName('General_VisitConvertedGoalId');
     $segment->setSegment('visitConvertedGoalId');
     $segment->setAcceptedValues('1, 2, 3, etc.');
     $this->addSegment($segment);
 }
示例#7
0
 protected function configureSegments()
 {
     $segment = new Segment();
     $segment->setSegment('events');
     $segment->setName('Events_TotalEvents');
     $segment->setAcceptedValues('To select all visits who triggered an Event, use: &segment=events>0');
     $segment->setCategory('General_Visit');
     $segment->setType(Segment::TYPE_METRIC);
     $this->addSegment($segment);
 }
示例#8
0
文件: UserId.php 项目: cemo/piwik
 protected function configureSegments()
 {
     $segment = new Segment();
     $segment->setType('dimension');
     $segment->setSegment('userId');
     $segment->setCategory(Piwik::translate('General_Visit'));
     $segment->setName('General_UserId');
     $segment->setAcceptedValues('any non empty unique string identifying the user (such as an email address or a username).');
     $segment->setSqlSegment('log_visit.user_id');
     $segment->setRequiresAtLeastViewAccess(true);
     $this->addSegment($segment);
 }
示例#9
0
 protected function configureSegments()
 {
     parent::configureSegments();
     $segment = new Segment();
     $segment->setType('dimension');
     $segment->setCategory(Piwik::translate('General_Visit'));
     $segment->setName(Piwik::translate('General_Visit') . " ID");
     $segment->setSegment('visitId');
     $segment->setAcceptedValues('Any integer.');
     $segment->setSqlSegment('log_visit.idvisit');
     $segment->setRequiresAtLeastViewAccess(true);
     $this->addSegment($segment);
 }
示例#10
0
 protected function configureSegments()
 {
     parent::configureSegments();
     $segment = new Segment();
     $segment->setType('dimension');
     $segment->setCategory(Piwik::translate('General_Visit'));
     $segment->setName('General_VisitorID');
     $segment->setSegment('visitorId');
     $segment->setAcceptedValues('34c31e04394bdc63 - any 16 Hexadecimal chars ID, which can be fetched using the Tracking API function getVisitorId()');
     $segment->setSqlSegment('log_visit.idvisitor');
     $segment->setSqlFilterValue(array('Piwik\\Common', 'convertVisitorIdToBin'));
     $segment->setRequiresAtLeastViewAccess(true);
     $this->addSegment($segment);
 }
示例#11
0
 protected function configureSegments()
 {
     parent::configureSegments();
     $segment = new Segment();
     $segment->setType('metric');
     $segment->setCategory(Piwik::translate('General_Visit'));
     $segment->setName('General_VisitorIP');
     $segment->setSegment('visitIp');
     $segment->setAcceptedValues('13.54.122.1. </code>Select IP ranges with notation: <code>visitIp>13.54.122.0;visitIp<13.54.122.255');
     $segment->setSqlSegment('log_visit.location_ip');
     $segment->setSqlFilterValue(array('Piwik\\Network\\IPUtils', 'stringToBinaryIP'));
     $segment->setRequiresAtLeastViewAccess(true);
     $this->addSegment($segment);
 }
 protected function configureSegments()
 {
     $segment = new Segment();
     $segment->setSegment('exitPageUrl');
     $segment->setName('Actions_ColumnExitPageURL');
     $segment->setCategory('General_Visit');
     $this->addSegment($segment);
     // custom type and sqlSegment
     $segment = new Segment();
     $segment->setSegment('exitPageUrl');
     $segment->setSqlSegment('customValue');
     $segment->setType(Segment::TYPE_METRIC);
     $segment->setName('Actions_ColumnExitPageURL');
     $segment->setCategory('General_Visit');
     $this->addSegment($segment);
 }
示例#13
0
 protected function configureSegmentsFor($segmentNameSuffix)
 {
     $numCustomVariables = CustomVariables::getNumUsableCustomVariables();
     $segment = new Segment();
     $segment->setType('dimension');
     $segment->setSegment('customVariable' . $segmentNameSuffix);
     $segment->setName($this->getName() . ' (' . Piwik::translate('CustomVariables_ScopeVisit') . ')');
     $segment->setCategory('CustomVariables_CustomVariables');
     $segment->setUnionOfSegments($this->getSegmentColumns('customVariable' . $segmentNameSuffix, $numCustomVariables));
     $this->addSegment($segment);
     $segment = new Segment();
     $segment->setType('dimension');
     $segment->setSegment('customVariablePage' . $segmentNameSuffix);
     $segment->setName($this->getName() . ' (' . Piwik::translate('CustomVariables_ScopePage') . ')');
     $segment->setCategory('CustomVariables_CustomVariables');
     $segment->setUnionOfSegments($this->getSegmentColumns('customVariablePage' . $segmentNameSuffix, $numCustomVariables));
     $this->addSegment($segment);
 }
示例#14
0
 protected function configureSegments()
 {
     $deviceTypes = DeviceParser::getAvailableDeviceTypeNames();
     $deviceTypeList = implode(", ", $deviceTypes);
     $segment = new Segment();
     $segment->setCategory('General_Visit');
     $segment->setSegment('deviceType');
     $segment->setName('DevicesDetection_DeviceType');
     $segment->setAcceptedValues($deviceTypeList);
     $segment->setSqlFilter(function ($type) use($deviceTypeList, $deviceTypes) {
         $index = array_search(strtolower(trim(urldecode($type))), $deviceTypes);
         if ($index === false) {
             throw new Exception("deviceType segment must be one of: {$deviceTypeList}");
         }
         return $index;
     });
     $this->addSegment($segment);
 }
示例#15
0
 protected function configureSegmentsFor($fieldPrefix, $segmentNameSuffix)
 {
     $numCustomVariables = CustomVariables::getNumUsableCustomVariables();
     $segment = new Segment();
     $segment->setType('dimension');
     $segment->setSegment('customVariable' . $segmentNameSuffix);
     $segment->setName($this->getName() . ' (' . Piwik::translate('CustomVariables_ScopeVisit') . ')');
     $segment->setCategory('CustomVariables_CustomVariables');
     $segment->setSqlSegment($this->getSegmentColumns('log_visit.' . $fieldPrefix, $numCustomVariables));
     $segment->setSuggestedValuesCallback(function ($idSite, $ignore, DataTable $table) use($segmentNameSuffix) {
         return $table->getColumnsStartingWith('customVariable' . $segmentNameSuffix);
     });
     $this->addSegment($segment);
     $segment = new Segment();
     $segment->setType('dimension');
     $segment->setSegment('customVariablePage' . $segmentNameSuffix);
     $segment->setName($this->getName() . ' (' . Piwik::translate('CustomVariables_ScopePage') . ')');
     $segment->setCategory('CustomVariables_CustomVariables');
     $segment->setSqlSegment($this->getSegmentColumns('log_link_visit_action.' . $fieldPrefix, $numCustomVariables));
     $segment->setSuggestedValuesCallback(function ($idSite, $ignore, DataTable $table) use($segmentNameSuffix) {
         return $table->getColumnsStartingWith('customVariablePage' . $segmentNameSuffix);
     });
     $this->addSegment($segment);
 }
 public function getSegmentsMetadata(&$segments, $idSites)
 {
     if (empty($idSites) || is_array($idSites) && count($idSites) !== 1) {
         return array();
     }
     if (is_array($idSites)) {
         $idSite = array_shift($idSites);
     } else {
         $idSite = $idSites;
     }
     $idSite = (int) $idSite;
     $dimensions = $this->configuration->getCustomDimensionsForSite($idSite);
     foreach ($dimensions as $dimension) {
         if (!$dimension['active']) {
             continue;
         }
         $segment = new Plugin\Segment();
         $segment->setSegment(CustomDimensionsRequestProcessor::buildCustomDimensionTrackingApiName($dimension));
         $segment->setType(Plugin\Segment::TYPE_DIMENSION);
         $segment->setName($dimension['name']);
         $columnName = LogTable::buildCustomDimensionColumnName($dimension);
         if ($dimension['scope'] === CustomDimensions::SCOPE_ACTION) {
             $segment->setSqlSegment('log_link_visit_action. ' . $columnName);
             $segment->setCategory('General_Actions');
             $segment->setSuggestedValuesCallback(function ($idSite, $maxValuesToReturn) use($dimension) {
                 $autoSuggest = new AutoSuggest();
                 return $autoSuggest->getMostUsedActionDimensionValues($dimension, $idSite, $maxValuesToReturn);
             });
         } elseif ($dimension['scope'] === CustomDimensions::SCOPE_VISIT) {
             $segment->setSqlSegment('log_visit. ' . $columnName);
             $segment->setCategory('General_Visit');
         } else {
             continue;
         }
         $segments[] = $segment->toArray();
     }
 }