本文整理汇总了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'];
}
}
}
}