当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::getCustomVariables方法代码示例

本文整理汇总了PHP中Piwik\Tracker\Request::getCustomVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getCustomVariables方法的具体用法?PHP Request::getCustomVariables怎么用?PHP Request::getCustomVariables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Tracker\Request的用法示例。


在下文中一共展示了Request::getCustomVariables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processRequestParams

 public function processRequestParams(VisitProperties $visitProperties, Request $request)
 {
     // TODO: re-add optimization where if custom variables exist in request, don't bother selecting them in Visitor
     $visitorCustomVariables = $request->getCustomVariables($scope = 'visit');
     if (!empty($visitorCustomVariables)) {
         Common::printDebug("Visit level Custom Variables: ");
         Common::printDebug($visitorCustomVariables);
     }
     $request->setMetadata('CustomVariables', 'visitCustomVariables', $visitorCustomVariables);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:10,代码来源:CustomVariablesRequestProcessor.php

示例2: handle

 /**
  *    Main algorithm to handle the visit.
  *
  *  Once we have the visitor information, we have to determine if the visit is a new or a known visit.
  *
  * 1) When the last action was done more than 30min ago,
  *      or if the visitor is new, then this is a new visit.
  *
  * 2) If the last action is less than 30min ago, then the same visit is going on.
  *    Because the visit goes on, we can get the time spent during the last action.
  *
  * NB:
  *  - In the case of a new visit, then the time spent
  *    during the last action of the previous visit is unknown.
  *
  *    - In the case of a new visit but with a known visitor,
  *    we can set the 'returning visitor' flag.
  *
  * In all the cases we set a cookie to the visitor with the new information.
  */
 public function handle()
 {
     // the IP is needed by isExcluded() and GoalManager->recordGoals()
     $this->visitorInfo['location_ip'] = $this->request->getIp();
     $excluded = new VisitExcluded($this->request, $this->visitorInfo['location_ip']);
     if ($excluded->isExcluded()) {
         return;
     }
     /**
      * 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.
      */
     Piwik::postEvent('Tracker.setVisitorIp', array(&$this->visitorInfo['location_ip']));
     $this->visitorCustomVariables = $this->request->getCustomVariables($scope = 'visit');
     if (!empty($this->visitorCustomVariables)) {
         Common::printDebug("Visit level Custom Variables: ");
         Common::printDebug($this->visitorCustomVariables);
     }
     $this->goalManager = new GoalManager($this->request);
     $visitIsConverted = false;
     $action = null;
     $isManualGoalConversion = $this->goalManager->isManualGoalConversion();
     $requestIsEcommerce = $this->goalManager->requestIsEcommerce;
     if ($requestIsEcommerce) {
         $someGoalsConverted = true;
         // Mark the visit as Converted only if it is an order (not for a Cart update)
         if ($this->goalManager->isGoalAnOrder()) {
             $visitIsConverted = true;
         }
     } elseif ($isManualGoalConversion) {
         // this request is from the JS call to piwikTracker.trackGoal()
         $someGoalsConverted = $this->goalManager->detectGoalId($this->request->getIdSite());
         $visitIsConverted = $someGoalsConverted;
         // if we find a idgoal in the URL, but then the goal is not valid, this is most likely a fake request
         if (!$someGoalsConverted) {
             Common::printDebug('Invalid goal tracking request for goal id = ' . $this->goalManager->idGoal);
             return;
         }
     } else {
         // normal page view, potentially triggering a URL matching goal
         $action = Action::factory($this->request);
         $action->writeDebugInfo();
         $someGoalsConverted = $this->goalManager->detectGoalsMatchingUrl($this->request->getIdSite(), $action);
         $visitIsConverted = $someGoalsConverted;
         $action->loadIdsFromLogActionTable();
     }
     /***
      * Visitor recognition
      */
     $visitorId = $this->getSettingsObject()->getConfigId();
     $visitor = new Visitor($this->request, $visitorId, $this->visitorInfo, $this->visitorCustomVariables);
     $visitor->recognize();
     $this->visitorInfo = $visitor->getVisitorInfo();
     $isLastActionInTheSameVisit = $this->isLastActionInTheSameVisit($visitor);
     if (!$isLastActionInTheSameVisit) {
         Common::printDebug("Visitor detected, but last action was more than 30 minutes ago...");
     }
     // Known visit when:
     // ( - the visitor has the Piwik cookie with the idcookie ID used by Piwik to match the visitor
     //   OR
     //   - the visitor doesn't have the Piwik cookie but could be match using heuristics @see recognizeTheVisitor()
     // )
     // AND
     // - the last page view for this visitor was less than 30 minutes ago @see isLastActionInTheSameVisit()
     if ($visitor->isVisitorKnown() && $isLastActionInTheSameVisit) {
         $idReferrerActionUrl = $this->visitorInfo['visit_exit_idaction_url'];
         $idReferrerActionName = $this->visitorInfo['visit_exit_idaction_name'];
         try {
             $this->goalManager->detectIsThereExistingCartInVisit($this->visitorInfo);
             $this->handleExistingVisit($visitor, $action, $visitIsConverted);
             if (!is_null($action)) {
                 $action->record($visitor, $idReferrerActionUrl, $idReferrerActionName);
             }
         } catch (VisitorNotFoundInDb $e) {
             // There is an edge case when:
             // - two manual goal conversions happen in the same second
//.........这里部分代码省略.........
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:101,代码来源:Visit.php

示例3: getCustomVariables

 public function getCustomVariables()
 {
     return $this->request->getCustomVariables($scope = 'page');
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:4,代码来源:Action.php


注:本文中的Piwik\Tracker\Request::getCustomVariables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。