本文整理匯總了PHP中Piwik\UrlHelper::extractSearchEngineInformationFromUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP UrlHelper::extractSearchEngineInformationFromUrl方法的具體用法?PHP UrlHelper::extractSearchEngineInformationFromUrl怎麽用?PHP UrlHelper::extractSearchEngineInformationFromUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Piwik\UrlHelper
的用法示例。
在下文中一共展示了UrlHelper::extractSearchEngineInformationFromUrl方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testExtractSearchEngineInformationFromUrl
/**
* @dataProvider getSearchEngineUrls
* @group Core
*/
public function testExtractSearchEngineInformationFromUrl($url, $engine, $keywords)
{
$this->includeDataFilesForSearchEngineTest();
$returnedValue = UrlHelper::extractSearchEngineInformationFromUrl($url);
$exptectedValue = false;
if (!empty($engine)) {
$exptectedValue = array('name' => $engine, 'keywords' => $keywords);
}
$this->assertEquals($exptectedValue, $returnedValue);
}
示例2: detectCampaignKeywordFromReferrerUrl
protected function detectCampaignKeywordFromReferrerUrl()
{
if (!empty($this->nameReferrerAnalyzed) && !empty($this->keywordReferrerAnalyzed)) {
// keyword is already set, we skip
return true;
}
// Set the Campaign keyword to the keyword found in the Referrer URL if any
if (!empty($this->nameReferrerAnalyzed)) {
$referrerUrlInfo = UrlHelper::extractSearchEngineInformationFromUrl($this->referrerUrl);
if (!empty($referrerUrlInfo['keywords'])) {
$this->keywordReferrerAnalyzed = $referrerUrlInfo['keywords'];
}
}
// Set the keyword, to the hostname found, in a Adsense Referrer URL '&url=' parameter
if (empty($this->keywordReferrerAnalyzed) && !empty($this->referrerUrlParse['query']) && !empty($this->referrerHost) && (strpos($this->referrerHost, 'googleads') !== false || strpos($this->referrerHost, 'doubleclick') !== false)) {
// This parameter sometimes is found & contains the page with the adsense ad bringing visitor to our site
$value = $this->getParameterValueFromReferrerUrl('url');
if (!empty($value)) {
$parsedAdsenseReferrerUrl = parse_url($value);
if (!empty($parsedAdsenseReferrerUrl['host'])) {
if (empty($this->nameReferrerAnalyzed)) {
$type = $this->getParameterValueFromReferrerUrl('ad_type');
$type = $type ? " ({$type})" : '';
$this->nameReferrerAnalyzed = self::LABEL_ADWORDS_NAME . $type;
$this->typeReferrerAnalyzed = Common::REFERRER_TYPE_CAMPAIGN;
}
$this->keywordReferrerAnalyzed = self::LABEL_PREFIX_ADWORDS_KEYWORD . $parsedAdsenseReferrerUrl['host'];
}
}
}
}