当前位置: 首页>>代码示例>>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;未经允许,请勿转载。