當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::overrideLocation方法代碼示例

本文整理匯總了PHP中Piwik\Tracker\Request::overrideLocation方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::overrideLocation方法的具體用法?PHP Request::overrideLocation怎麽用?PHP Request::overrideLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik\Tracker\Request的用法示例。


在下文中一共展示了Request::overrideLocation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handleNewVisit

 /**
  * In the case of a new visit, we have to do the following actions:
  *
  * 1) Insert the new action
  *
  * 2) Insert the visit information
  *
  * @param Action $action
  * @param bool $visitIsConverted
  */
 protected function handleNewVisit($action, $visitIsConverted)
 {
     Common::printDebug("New Visit (IP = " . IP::N2P($this->getVisitorIp()) . ")");
     $this->visitorInfo = $this->getNewVisitorInformation($action);
     // Add Custom variable key,value to the visitor array
     $this->visitorInfo = array_merge($this->visitorInfo, $this->visitorCustomVariables);
     $this->visitorInfo['visit_goal_converted'] = $visitIsConverted ? 1 : 0;
     $this->visitorInfo['referer_name'] = substr($this->visitorInfo['referer_name'], 0, 70);
     $this->visitorInfo['referer_keyword'] = substr($this->visitorInfo['referer_keyword'], 0, 255);
     $this->visitorInfo['config_resolution'] = substr($this->visitorInfo['config_resolution'], 0, 9);
     /**
      * Triggered before a new [visit entity](/guides/persistence-and-the-mysql-backend#visits) is persisted.
      * 
      * This event can be used to modify the visit entity or add new information to it before it is persisted.
      * The UserCountry plugin, for example, uses this event to add location information for each visit.
      *
      * @param array &$visit The visit entity. Read [this](/guides/persistence-and-the-mysql-backend#visits) to see
      *                      what information it contains.
      * @param \Piwik\Tracker\Request $request An object describing the tracking request being processed.
      */
     Piwik::postEvent('Tracker.newVisitorInformation', array(&$this->visitorInfo, $this->request));
     $this->request->overrideLocation($this->visitorInfo);
     $this->printVisitorInformation();
     $idVisit = $this->insertNewVisit($this->visitorInfo);
     $this->visitorInfo['idvisit'] = $idVisit;
     $this->visitorInfo['visit_first_action_time'] = $this->request->getCurrentTimestamp();
     $this->visitorInfo['visit_last_action_time'] = $this->request->getCurrentTimestamp();
 }
開發者ID:carriercomm,項目名稱:piwik,代碼行數:38,代碼來源:Visit.php


注:本文中的Piwik\Tracker\Request::overrideLocation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。