本文整理匯總了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();
}