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


PHP Piwik_Common::getCampaignParameters方法代碼示例

本文整理匯總了PHP中Piwik_Common::getCampaignParameters方法的典型用法代碼示例。如果您正苦於以下問題:PHP Piwik_Common::getCampaignParameters方法的具體用法?PHP Piwik_Common::getCampaignParameters怎麽用?PHP Piwik_Common::getCampaignParameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik_Common的用法示例。


在下文中一共展示了Piwik_Common::getCampaignParameters方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: excludeQueryParametersFromUrl

	static public function excludeQueryParametersFromUrl($originalUrl, $idSite)
	{
		$website = Piwik_Common::getCacheWebsiteAttributes( $idSite );
		$originalUrl = Piwik_Common::unsanitizeInputValue($originalUrl);
		$originalUrl = self::cleanupString($originalUrl);
		$parsedUrl = @parse_url($originalUrl);
		if(empty($parsedUrl['query']))
		{
			return $originalUrl;
		}
		$campaignTrackingParameters = Piwik_Common::getCampaignParameters();
		
		$campaignTrackingParameters = array_merge(
				$campaignTrackingParameters[0], // campaign name parameters
				$campaignTrackingParameters[1] // campaign keyword parameters
		);	
				
		$excludedParameters = isset($website['excluded_parameters']) 
									? $website['excluded_parameters'] 
									: array();
									
		$parametersToExclude = array_merge( $excludedParameters, 
											self::$queryParametersToExclude,
											$campaignTrackingParameters);
											
		$parametersToExclude = array_map('strtolower', $parametersToExclude);
		$queryParameters = Piwik_Common::getArrayFromQueryString($parsedUrl['query']);
		
		$validQuery = '';
		$separator = '&';
		foreach($queryParameters as $name => $value)
		{
			if(!in_array(strtolower($name), $parametersToExclude))
			{
				if (is_array($value))
				{
					foreach ($value as $param)
					{
						if($param === false)
						{
							$validQuery .= $name.'[]'.$separator;
						}
						else
						{
							$validQuery .= $name.'[]='.$param.$separator;
						}
					}
				}
				else if($value === false)
				{
					$validQuery .= $name.$separator;
				}
				else
				{
					$validQuery .= $name.'='.$value.$separator;
				}
			}
		}
		$parsedUrl['query'] = substr($validQuery,0,-strlen($separator));
		$url = Piwik_Common::getParseUrlReverse($parsedUrl);
		printDebug('Excluding parameters "'.implode(',',$excludedParameters).'" from URL');
		if($originalUrl != $url)
		{
			printDebug(' Before was "'.$originalUrl.'"');
			printDebug(' After is "'.$url.'"');
		}
		return $url;
	}
開發者ID:BackupTheBerlios,項目名稱:oos-svn,代碼行數:68,代碼來源:Action.php

示例2: detectRefererCampaign

 protected function detectRefererCampaign()
 {
     if (isset($this->currentUrlParse['query'])) {
         $campaignParameters = Piwik_Common::getCampaignParameters();
         $campaignNames = $campaignParameters[0];
         foreach ($campaignNames as $campaignNameParameter) {
             $campaignName = Piwik_Common::getParameterFromQueryString($this->currentUrlParse['query'], $campaignNameParameter);
             if (!empty($campaignName)) {
                 break;
             }
         }
         if (!empty($campaignName)) {
             $this->typeRefererAnalyzed = Piwik_Common::REFERER_TYPE_CAMPAIGN;
             $this->nameRefererAnalyzed = $campaignName;
             $campaignKeywords = $campaignParameters[1];
             foreach ($campaignKeywords as $campaignKeywordParameter) {
                 $campaignKeyword = Piwik_Common::getParameterFromQueryString($this->currentUrlParse['query'], $campaignKeywordParameter);
                 if (!empty($campaignKeyword)) {
                     $this->keywordRefererAnalyzed = $campaignKeyword;
                     break;
                 }
             }
             return true;
         }
     }
     return false;
 }
開發者ID:Gninety,項目名稱:Microweber,代碼行數:27,代碼來源:Visit.php

示例3: detectRefererCampaign

 /**
  * Campaign analysis
  * @return bool
  */
 protected function detectRefererCampaign()
 {
     if (!isset($this->currentUrlParse['query']) && !isset($this->currentUrlParse['fragment'])) {
         return false;
     }
     $campaignParameters = Piwik_Common::getCampaignParameters();
     $this->campaignNames = $campaignParameters[0];
     $this->campaignKeywords = $campaignParameters[1];
     $found = false;
     // 1) Detect campaign from query string
     if (isset($this->currentUrlParse['query'])) {
         $found = $this->detectCampaignFromString($this->currentUrlParse['query']);
     }
     // 2) Detect from fragment #hash
     if (!$found && isset($this->currentUrlParse['fragment'])) {
         $found = $this->detectCampaignFromString($this->currentUrlParse['fragment']);
     }
     return $found;
 }
開發者ID:nnnnathann,項目名稱:piwik,代碼行數:23,代碼來源:Visit.php

示例4: getQueryParametersToExclude

 /**
  * Returns the array of parameters names that must be excluded from the Query String in all tracked URLs
  * @static
  * @param $idSite
  * @return array
  */
 public static function getQueryParametersToExclude($idSite)
 {
     $campaignTrackingParameters = Piwik_Common::getCampaignParameters();
     $campaignTrackingParameters = array_merge($campaignTrackingParameters[0], $campaignTrackingParameters[1]);
     $website = Piwik_Common::getCacheWebsiteAttributes($idSite);
     $excludedParameters = isset($website['excluded_parameters']) ? $website['excluded_parameters'] : array();
     if (!empty($excludedParameters)) {
         printDebug('Excluding parameters "' . implode(',', $excludedParameters) . '" from URL');
     }
     $parametersToExclude = array_merge($excludedParameters, self::$queryParametersToExclude, $campaignTrackingParameters);
     $parametersToExclude = array_map('strtolower', $parametersToExclude);
     return $parametersToExclude;
 }
開發者ID:nomoto-ubicast,項目名稱:piwik,代碼行數:19,代碼來源:Action.php


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