本文整理汇总了PHP中Piwik\Tracker\Request::getParam方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getParam方法的具体用法?PHP Request::getParam怎么用?PHP Request::getParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Tracker\Request
的用法示例。
在下文中一共展示了Request::getParam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onNewVisit
/**
* @param Request $request
* @param Visitor $visitor
* @param Action|null $action
* @return mixed
*/
public function onNewVisit(Request $request, Visitor $visitor, $action)
{
$referrerUrl = $request->getParam('urlref');
$currentUrl = $request->getParam('url');
$information = $this->getReferrerInformation($referrerUrl, $currentUrl, $request->getIdSite());
return $information['referer_url'];
}
示例2: shouldHandle
public static function shouldHandle(Request $request)
{
$name = $request->getParam('c_n');
$interaction = $request->getParam('c_i');
// if interaction is set we want it to be for instance an outlink, download, ...
return !empty($name) && empty($interaction);
}
示例3: onNewVisit
/**
* @param Request $request
* @param Visitor $visitor
* @param Action|null $action
* @return mixed
*/
public function onNewVisit(Request $request, Visitor $visitor, $action)
{
$referrerUrl = $request->getParam('urlref');
$currentUrl = $request->getParam('url');
$information = $this->getReferrerInformation($referrerUrl, $currentUrl, $request->getIdSite());
if (!empty($information['referer_keyword'])) {
return substr($information['referer_keyword'], 0, 255);
}
return $information['referer_keyword'];
}
示例4: getNewVisitorInformation
protected function getNewVisitorInformation($action)
{
$actionType = $idActionName = $idActionUrl = false;
if ($action) {
$idActionUrl = $action->getIdActionUrlForEntryAndExitIds();
$idActionName = $action->getIdActionNameForEntryAndExitIds();
$actionType = $action->getActionType();
}
$daysSinceFirstVisit = $this->request->getDaysSinceFirstVisit();
$visitCount = $this->request->getVisitCount();
$daysSinceLastVisit = $this->request->getDaysSinceLastVisit();
$daysSinceLastOrder = $this->request->getDaysSinceLastOrder();
$isReturningCustomer = $daysSinceLastOrder !== false;
if ($daysSinceLastOrder === false) {
$daysSinceLastOrder = 0;
}
// User settings
$userInfo = $this->getSettingsObject();
$userInfo = $userInfo->getInfo();
// Referrer data
$referrer = new Referrer();
$referrerUrl = $this->request->getParam('urlref');
$currentUrl = $this->request->getParam('url');
$referrerInfo = $referrer->getReferrerInformation($referrerUrl, $currentUrl, $this->request->getIdSite());
$visitorReturning = $isReturningCustomer ? 2 : ($visitCount > 1 || $this->isVisitorKnown() || $daysSinceLastVisit > 0 ? 1 : 0);
$defaultTimeOnePageVisit = Config::getInstance()->Tracker['default_time_one_page_visit'];
return array('idsite' => $this->request->getIdSite(), 'visitor_localtime' => $this->request->getLocalTime(), 'idvisitor' => $this->getVisitorIdcookie(), 'visitor_returning' => $visitorReturning, 'visitor_count_visits' => $visitCount, 'visitor_days_since_last' => $daysSinceLastVisit, 'visitor_days_since_order' => $daysSinceLastOrder, 'visitor_days_since_first' => $daysSinceFirstVisit, 'visit_first_action_time' => Tracker::getDatetimeFromTimestamp($this->request->getCurrentTimestamp()), 'visit_last_action_time' => Tracker::getDatetimeFromTimestamp($this->request->getCurrentTimestamp()), 'visit_entry_idaction_url' => (int) $idActionUrl, 'visit_entry_idaction_name' => (int) $idActionName, 'visit_exit_idaction_url' => (int) $idActionUrl, 'visit_exit_idaction_name' => (int) $idActionName, 'visit_total_actions' => in_array($actionType, array(Action::TYPE_PAGE_URL, Action::TYPE_DOWNLOAD, Action::TYPE_OUTLINK, Action::TYPE_SITE_SEARCH, Action::TYPE_EVENT)) ? 1 : 0, 'visit_total_searches' => $actionType == Action::TYPE_SITE_SEARCH ? 1 : 0, 'visit_total_events' => $actionType == Action::TYPE_EVENT ? 1 : 0, 'visit_total_time' => self::cleanupVisitTotalTime($defaultTimeOnePageVisit), 'visit_goal_buyer' => $this->goalManager->getBuyerType(), 'referer_type' => $referrerInfo['referer_type'], 'referer_name' => $referrerInfo['referer_name'], 'referer_url' => $referrerInfo['referer_url'], 'referer_keyword' => $referrerInfo['referer_keyword'], 'config_id' => $userInfo['config_id'], 'config_os' => $userInfo['config_os'], 'config_browser_name' => $userInfo['config_browser_name'], 'config_browser_version' => $userInfo['config_browser_version'], 'config_resolution' => $userInfo['config_resolution'], 'config_pdf' => $userInfo['config_pdf'], 'config_flash' => $userInfo['config_flash'], 'config_java' => $userInfo['config_java'], 'config_director' => $userInfo['config_director'], 'config_quicktime' => $userInfo['config_quicktime'], 'config_realplayer' => $userInfo['config_realplayer'], 'config_windowsmedia' => $userInfo['config_windowsmedia'], 'config_gears' => $userInfo['config_gears'], 'config_silverlight' => $userInfo['config_silverlight'], 'config_cookie' => $userInfo['config_cookie'], 'location_ip' => $this->getVisitorIp(), 'location_browser_lang' => $userInfo['location_browser_lang']);
}
示例5: onNewVisit
/**
* @param Request $request
* @param Visitor $visitor
* @param Action|null $action
* @return mixed
*/
public function onNewVisit(Request $request, Visitor $visitor, $action)
{
// Adding &dp=1 will disable the provider plugin, this is an "unofficial" parameter used to speed up log importer
$disableProvider = $request->getParam('dp');
if (!empty($disableProvider)) {
return false;
}
// if provider info has already been set, abort
$locationValue = $visitor->getVisitorColumn('location_provider');
if (!empty($locationValue)) {
return false;
}
$ip = $visitor->getVisitorColumn('location_ip');
$privacyConfig = new PrivacyManagerConfig();
if (!$privacyConfig->useAnonymizedIpForVisitEnrichment) {
$ip = $request->getIp();
}
$ip = IPUtils::binaryToStringIP($ip);
// In case the IP was anonymized, we should not continue since the DNS reverse lookup will fail and this will slow down tracking
if (substr($ip, -2, 2) == '.0') {
Common::printDebug("IP Was anonymized so we skip the Provider DNS reverse lookup...");
return false;
}
$hostname = $this->getHost($ip);
$hostnameExtension = ProviderPlugin::getCleanHostname($hostname);
// add the provider value in the table log_visit
$locationProvider = substr($hostnameExtension, 0, 100);
return $locationProvider;
}
示例6: onExistingVisit
/**
* @param Request $request
* @param Visitor $visitor
* @param Action|null $action
* @return mixed
*/
public function onExistingVisit(Request $request, Visitor $visitor, $action)
{
if ($request->getParam('ping') == 1) {
return false;
}
return $this->onNewVisit($request, $visitor, $action);
}
示例7: onNewVisit
/**
* @param Request $request
* @param Visitor $visitor
* @param Action|null $action
* @return mixed
*/
public function onNewVisit(Request $request, Visitor $visitor, $action)
{
$resolution = $request->getParam('res');
if (!empty($resolution)) {
return substr($resolution, 0, 9);
}
return $resolution;
}
示例8: onLookupAction
public function onLookupAction(Request $request, Action $action)
{
$contentTarget = $request->getParam('c_t');
$contentTarget = trim($contentTarget);
if (strlen($contentTarget) > 0) {
return $contentTarget;
}
return false;
}
示例9: getValueForDimension
private function getValueForDimension(Request $request)
{
/** @var Action $action */
$action = $request->getMetadata('Actions', 'action');
if (in_array($this->dimension, array('url', 'urlparam'))) {
if (!empty($action)) {
$dimension = $action->getActionUrlRaw();
} else {
$dimension = $request->getParam('url');
}
} elseif ($this->dimension === 'action_name' && !empty($action)) {
$dimension = $action->getActionName();
} else {
$dimension = $request->getParam($this->dimension);
}
if (!empty($dimension)) {
$dimension = Common::unsanitizeInputValue($dimension);
}
return $dimension;
}
示例10: onLookupAction
public function onLookupAction(Request $request, Action $action)
{
$contentPiece = $request->getParam('c_p');
if (empty($contentPiece)) {
return false;
}
$contentPiece = trim($contentPiece);
if (strlen($contentPiece) > 0) {
return $contentPiece;
}
return false;
}
示例11: onLookupAction
public function onLookupAction(Request $request, Action $action)
{
if (!$action instanceof ActionEvent) {
return false;
}
$eventAction = $request->getParam('e_a');
$eventAction = trim($eventAction);
if (strlen($eventAction) > 0) {
return $eventAction;
}
return false;
}
示例12: isSpam
/**
* Check if the request is from a known spammer host.
*
* @param Request $request
* @return bool
*/
public function isSpam(Request $request)
{
$spammers = $this->getSpammerListFromCache();
$referrerUrl = $request->getParam('urlref');
foreach ($spammers as $spammerHost) {
if (stripos($referrerUrl, $spammerHost) !== false) {
Common::printDebug('Referrer URL is a known spam: ' . $spammerHost);
return true;
}
}
return false;
}
示例13: onLookupAction
public function onLookupAction(Request $request, Action $action)
{
$interaction = $request->getParam('c_i');
if (empty($interaction)) {
return false;
}
$interaction = trim($interaction);
if (strlen($interaction) > 0) {
return $interaction;
}
return false;
}
示例14: factory
/**
* Makes the correct Action object based on the request.
*
* @param Request $request
* @return ActionClickUrl|ActionPageview|ActionSiteSearch
*/
public static function factory(Request $request)
{
$downloadUrl = $request->getParam('download');
if (!empty($downloadUrl)) {
return new ActionClickUrl(self::TYPE_DOWNLOAD, $downloadUrl, $request);
}
$outlinkUrl = $request->getParam('link');
if (!empty($outlinkUrl)) {
return new ActionClickUrl(self::TYPE_OUTLINK, $outlinkUrl, $request);
}
$url = $request->getParam('url');
$eventCategory = $request->getParam('e_c');
$eventAction = $request->getParam('e_a');
if (strlen($eventCategory) > 0 && strlen($eventAction) > 0) {
return new ActionEvent($eventCategory, $eventAction, $url, $request);
}
$action = new ActionSiteSearch($url, $request);
if ($action->isSearchDetected()) {
return $action;
}
return new ActionPageview($url, $request);
}
示例15: onConvertedVisit
/**
* @param Request $request
* @param Visitor $visitor
* @param Action|null $action
* @return int
*/
public function onConvertedVisit(Request $request, Visitor $visitor, $action)
{
if (!$visitor->isVisitorKnown()) {
return false;
}
$totalTime = $visitor->getVisitorColumn('visit_total_time');
// If a pageview and goal conversion in the same second, with previously a goal conversion recorded
// the request would not "update" the row since all values are the same as previous
// therefore the request below throws exception, instead we make sure the UPDATE will affect the row
$totalTime = $totalTime + $request->getParam('idgoal');
// +2 to offset idgoal=-1 and idgoal=0
$totalTime = $totalTime + 2;
return $this->cleanupVisitTotalTime($totalTime);
}