當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UrlHelper::extractSearchEngineInformationFromUrl方法代碼示例

本文整理匯總了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);
 }
開發者ID:ahdinosaur,項目名稱:analytics.dinosaur.is,代碼行數:14,代碼來源:UrlHelperTest.php

示例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'];
             }
         }
     }
 }
開發者ID:nuxwin,項目名稱:piwik,代碼行數:31,代碼來源:Base.php


注:本文中的Piwik\UrlHelper::extractSearchEngineInformationFromUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。