コード例 #1
0
ファイル: Visit.php プロジェクト: BackupTheBerlios/oos-svn
 protected function saveVisitorInformation()
 {
     Piwik_PostEvent('Tracker.saveVisitorInformation', $this->visitorInfo);
     $serverTime = $this->getCurrentTimestamp();
     $this->visitorInfo['location_continent'] = Piwik_Common::getContinent($this->visitorInfo['location_country']);
     $this->visitorInfo['location_browser_lang'] = substr($this->visitorInfo['location_browser_lang'], 0, 20);
     $this->visitorInfo['referer_name'] = substr($this->visitorInfo['referer_name'], 0, 70);
     $this->visitorInfo['referer_keyword'] = substr($this->visitorInfo['referer_keyword'], 0, 255);
     $this->visitorInfo['config_resolution'] = substr($this->visitorInfo['config_resolution'], 0, 9);
     $fields = implode(", ", array_keys($this->visitorInfo));
     $values = substr(str_repeat("?,", count($this->visitorInfo)), 0, -1);
     printDebug($this->visitorInfo);
     Piwik_Tracker::getDatabase()->query("INSERT INTO " . Piwik_Common::prefixTable('log_visit') . " ({$fields}) VALUES ({$values})", array_values($this->visitorInfo));
     $idVisit = Piwik_Tracker::getDatabase()->lastInsertId();
     $this->visitorInfo['idvisit'] = $idVisit;
     $this->visitorInfo['visit_first_action_time'] = $serverTime;
     $this->visitorInfo['visit_last_action_time'] = $serverTime;
     Piwik_PostEvent('Tracker.saveVisitorInformation.end', $this->visitorInfo);
 }
コード例 #2
0
ファイル: GoalManager.php プロジェクト: klando/pgpiwik
 function recordGoals($visitorInformation, $action)
 {
     $location_country = isset($visitorInformation['location_country']) ? $visitorInformation['location_country'] : Piwik_Common::getCountry(Piwik_Common::getBrowserLanguage(), $enableLanguageToCountryGuess = Piwik_Tracker_Config::getInstance()->Tracker['enable_language_to_country_guess']);
     $location_continent = isset($visitorInformation['location_continent']) ? $visitorInformation['location_continent'] : Piwik_Common::getContinent($location_country);
     $goal = array('idvisit' => $visitorInformation['idvisit'], 'idsite' => $visitorInformation['idsite'], 'visitor_idcookie' => $visitorInformation['visitor_idcookie'], 'server_time' => Piwik_Tracker::getDatetimeFromTimestamp($visitorInformation['visit_last_action_time']), 'visit_server_date' => $visitorInformation['visit_server_date'], 'location_country' => $location_country, 'location_continent' => $location_continent, 'visitor_returning' => $this->cookie->get(Piwik_Tracker::COOKIE_INDEX_VISITOR_RETURNING));
     $referer_idvisit = $this->cookie->get(Piwik_Tracker::COOKIE_INDEX_REFERER_ID_VISIT);
     if ($referer_idvisit !== false) {
         $goal += array('referer_idvisit' => $referer_idvisit, 'referer_visit_server_date' => date("Y-m-d", $this->cookie->get(Piwik_Tracker::COOKIE_INDEX_REFERER_TIMESTAMP)), 'referer_type' => htmlspecialchars_decode($this->cookie->get(Piwik_Tracker::COOKIE_INDEX_REFERER_TYPE)), 'referer_name' => htmlspecialchars_decode($this->cookie->get(Piwik_Tracker::COOKIE_INDEX_REFERER_NAME)), 'referer_keyword' => htmlspecialchars_decode($this->cookie->get(Piwik_Tracker::COOKIE_INDEX_REFERER_KEYWORD)));
     }
     foreach ($this->convertedGoals as $convertedGoal) {
         printDebug("- Goal " . $convertedGoal['idgoal'] . " matched. Recording...");
         $newGoal = $goal;
         $newGoal['idgoal'] = $convertedGoal['idgoal'];
         $newGoal['url'] = $convertedGoal['url'];
         $newGoal['revenue'] = $convertedGoal['revenue'];
         if (!is_null($action)) {
             $newGoal['idaction'] = $action->getIdAction();
             $newGoal['idlink_va'] = $action->getIdLinkVisitAction();
         }
         printDebug($newGoal);
         $fields = implode(", ", array_keys($newGoal));
         $bindFields = substr(str_repeat("?,", count($newGoal)), 0, -1);
         try {
             Piwik_Tracker::getDatabase()->query("INSERT INTO " . Piwik_Common::prefixTable('log_conversion') . "\t({$fields}) \n\t\t\t\t\tVALUES ({$bindFields}) ", array_values($newGoal));
         } catch (Exception $e) {
             if (strpos($e->getMessage(), '1062') !== false) {
                 // integrity violation when same visit converts to the same goal twice
                 printDebug("--> Goal already recorded for this (idvisit, idgoal)");
             } else {
                 throw $e;
             }
         }
         //$idlog_goal = Piwik_Tracker::getDatabase()->lastInsertId();
     }
 }
コード例 #3
0
ファイル: GoalManager.php プロジェクト: Gninety/Microweber
 function recordGoals($idSite, $visitorInformation, $visitCustomVariables, $action, $referrerTimestamp, $referrerUrl, $referrerCampaignName, $referrerCampaignKeyword)
 {
     $location_country = isset($visitorInformation['location_country']) ? $visitorInformation['location_country'] : Piwik_Common::getCountry(Piwik_Common::getBrowserLanguage(), $enableLanguageToCountryGuess = Piwik_Tracker_Config::getInstance()->Tracker['enable_language_to_country_guess'], $visitorInformation['location_ip']);
     $location_continent = isset($visitorInformation['location_continent']) ? $visitorInformation['location_continent'] : Piwik_Common::getContinent($location_country);
     $goal = array('idvisit' => $visitorInformation['idvisit'], 'idsite' => $idSite, 'idvisitor' => $visitorInformation['idvisitor'], 'server_time' => Piwik_Tracker::getDatetimeFromTimestamp($visitorInformation['visit_last_action_time']), 'location_country' => $location_country, 'location_continent' => $location_continent, 'visitor_returning' => $visitorInformation['visitor_returning'], 'visitor_days_since_first' => $visitorInformation['visitor_days_since_first'], 'visitor_count_visits' => $visitorInformation['visitor_count_visits']);
     // Attributing the correct Referrer to this conversion.
     // Priority order is as follows:
     // 1) Campaign name/kwd parsed in the JS
     // 2) Referrer URL stored in the _ref cookie
     // 3) If no info from the cookie, attribute to the current visit referrer
     // 3) Default values: current referrer
     $type = $visitorInformation['referer_type'];
     $name = $visitorInformation['referer_name'];
     $keyword = $visitorInformation['referer_keyword'];
     $time = $visitorInformation['visit_first_action_time'];
     // 1) Campaigns from 1st party cookie
     if (!empty($referrerCampaignName)) {
         $type = Piwik_Common::REFERER_TYPE_CAMPAIGN;
         $name = $referrerCampaignName;
         $keyword = $referrerCampaignKeyword;
         $time = $referrerTimestamp;
     } elseif (!empty($referrerUrl)) {
         $referrer = new Piwik_Tracker_Visit_Referer();
         $referrer = $referrer->getRefererInformation($referrerUrl, $currentUrl = '', $idSite);
         // if the parsed referer is interesting enough, ie. website or search engine
         if (in_array($referrer['referer_type'], array(Piwik_Common::REFERER_TYPE_SEARCH_ENGINE, Piwik_Common::REFERER_TYPE_WEBSITE))) {
             $type = $referrer['referer_type'];
             $name = $referrer['referer_name'];
             $keyword = $referrer['referer_keyword'];
             $time = $referrerTimestamp;
         }
     }
     $goal += array('referer_type' => $type, 'referer_name' => $name, 'referer_keyword' => $keyword, 'referer_visit_server_date' => date("Y-m-d", $time));
     $goal += $visitCustomVariables;
     foreach ($this->convertedGoals as $convertedGoal) {
         printDebug("- Goal " . $convertedGoal['idgoal'] . " matched. Recording...");
         $newGoal = $goal;
         $newGoal['idgoal'] = $convertedGoal['idgoal'];
         $newGoal['url'] = $convertedGoal['url'];
         $newGoal['revenue'] = $convertedGoal['revenue'];
         if (!is_null($action)) {
             $newGoal['idaction_url'] = $action->getIdActionUrl();
             $newGoal['idlink_va'] = $action->getIdLinkVisitAction();
         }
         // If multiple Goal conversions per visit, set a cache buster
         $newGoal['buster'] = $convertedGoal['allow_multiple'] == 0 ? '0' : $visitorInformation['visit_last_action_time'];
         $newGoalDebug = $newGoal;
         $newGoalDebug['idvisitor'] = bin2hex($newGoalDebug['idvisitor']);
         printDebug($newGoalDebug);
         $fields = implode(", ", array_keys($newGoal));
         $bindFields = substr(str_repeat("?,", count($newGoal)), 0, -1);
         $sql = "INSERT IGNORE INTO " . Piwik_Common::prefixTable('log_conversion') . "\t\n\t\t\t\t\t({$fields}) VALUES ({$bindFields}) ";
         $bind = array_values($newGoal);
         Piwik_Tracker::getDatabase()->query($sql, $bind);
     }
 }
コード例 #4
0
ファイル: GoalManager.php プロジェクト: nnnnathann/piwik
 /**
  * Records one or several goals matched in this request.
  * @param int $idSite
  * @param array $visitorInformation
  * @param array $visitCustomVariables
  * @param string $action
  * @param $referrerTimestamp
  * @param string $referrerUrl
  * @param string $referrerCampaignName
  * @param string $referrerCampaignKeyword
  */
 public function recordGoals($idSite, $visitorInformation, $visitCustomVariables, $action, $referrerTimestamp, $referrerUrl, $referrerCampaignName, $referrerCampaignKeyword, $browserLanguage)
 {
     $location_country = isset($visitorInformation['location_country']) ? $visitorInformation['location_country'] : Piwik_Common::getCountry($browserLanguage, $enableLanguageToCountryGuess = Piwik_Config::getInstance()->Tracker['enable_language_to_country_guess'], $visitorInformation['location_ip']);
     $location_continent = isset($visitorInformation['location_continent']) ? $visitorInformation['location_continent'] : Piwik_Common::getContinent($location_country);
     $goal = array('idvisit' => $visitorInformation['idvisit'], 'idsite' => $idSite, 'idvisitor' => $visitorInformation['idvisitor'], 'server_time' => Piwik_Tracker::getDatetimeFromTimestamp($visitorInformation['visit_last_action_time']), 'location_country' => $location_country, 'location_continent' => $location_continent, 'visitor_returning' => $visitorInformation['visitor_returning'], 'visitor_days_since_first' => $visitorInformation['visitor_days_since_first'], 'visitor_days_since_order' => $visitorInformation['visitor_days_since_order'], 'visitor_count_visits' => $visitorInformation['visitor_count_visits']);
     // Copy Custom Variables from Visit row to the Goal conversion
     for ($i = 1; $i <= Piwik_Tracker::MAX_CUSTOM_VARIABLES; $i++) {
         if (isset($visitorInformation['custom_var_k' . $i]) && strlen($visitorInformation['custom_var_k' . $i])) {
             $goal['custom_var_k' . $i] = $visitorInformation['custom_var_k' . $i];
         }
         if (isset($visitorInformation['custom_var_v' . $i]) && strlen($visitorInformation['custom_var_v' . $i])) {
             $goal['custom_var_v' . $i] = $visitorInformation['custom_var_v' . $i];
         }
     }
     // Otherwise, set the Custom Variables found in the cookie sent with this request
     $goal += $visitCustomVariables;
     // Attributing the correct Referrer to this conversion.
     // Priority order is as follows:
     // 0) In some cases, the campaign is not passed from the JS so we look it up from the current visit
     // 1) Campaign name/kwd parsed in the JS
     // 2) Referrer URL stored in the _ref cookie
     // 3) If no info from the cookie, attribute to the current visit referrer
     // 3) Default values: current referrer
     $type = $visitorInformation['referer_type'];
     $name = $visitorInformation['referer_name'];
     $keyword = $visitorInformation['referer_keyword'];
     $time = $visitorInformation['visit_first_action_time'];
     // 0) In some (unknown!?) cases the campaign is not found in the attribution cookie, but the URL ref was found.
     //    In this case we look up if the current visit is credited to a campaign and will credit this campaign rather than the URL ref (since campaigns have higher priority)
     if (empty($refererCampaignName) && $type == Piwik_Common::REFERER_TYPE_CAMPAIGN && !empty($name)) {
         // Use default values per above
     } elseif (!empty($referrerCampaignName)) {
         $type = Piwik_Common::REFERER_TYPE_CAMPAIGN;
         $name = $referrerCampaignName;
         $keyword = $referrerCampaignKeyword;
         $time = $referrerTimestamp;
     } elseif (!empty($referrerUrl)) {
         $referrer = new Piwik_Tracker_Visit_Referer();
         $referrer = $referrer->getRefererInformation($referrerUrl, $currentUrl = '', $idSite);
         // if the parsed referer is interesting enough, ie. website or search engine
         if (in_array($referrer['referer_type'], array(Piwik_Common::REFERER_TYPE_SEARCH_ENGINE, Piwik_Common::REFERER_TYPE_WEBSITE))) {
             $type = $referrer['referer_type'];
             $name = $referrer['referer_name'];
             $keyword = $referrer['referer_keyword'];
             $time = $referrerTimestamp;
         }
     }
     $goal += array('referer_type' => $type, 'referer_name' => $name, 'referer_keyword' => $keyword, 'referer_visit_server_date' => date("Y-m-d", $time));
     // some goals are converted, so must be ecommerce Order or Cart Update
     if ($this->requestIsEcommerce) {
         $this->recordEcommerceGoal($goal, $visitorInformation);
     } else {
         $this->recordStandardGoals($goal, $action, $visitorInformation);
     }
 }
コード例 #5
0
ファイル: Visit.php プロジェクト: nnnnathann/piwik
 /**
  * Save new visitor information to log_visit table.
  * Provides pre- and post- event hooks (Tracker.saveVisitorInformation and Tracker.saveVisitorInformation.end) for plugins
  */
 protected function saveVisitorInformation()
 {
     Piwik_PostEvent('Tracker.saveVisitorInformation', $this->visitorInfo);
     if (empty($this->visitorInfo['location_country'])) {
         $this->visitorInfo['location_country'] = 'xx';
     }
     $this->visitorInfo['location_continent'] = Piwik_Common::getContinent($this->visitorInfo['location_country']);
     $this->visitorInfo['location_browser_lang'] = substr($this->visitorInfo['location_browser_lang'], 0, 20);
     $this->visitorInfo['referer_name'] = substr($this->visitorInfo['referer_name'], 0, 70);
     $this->visitorInfo['referer_keyword'] = substr($this->visitorInfo['referer_keyword'], 0, 255);
     $this->visitorInfo['config_resolution'] = substr($this->visitorInfo['config_resolution'], 0, 9);
     $fields = implode(", ", array_keys($this->visitorInfo));
     $values = Piwik_Common::getSqlStringFieldsArray($this->visitorInfo);
     $sql = "INSERT INTO " . Piwik_Common::prefixTable('log_visit') . " ({$fields}) VALUES ({$values})";
     $bind = array_values($this->visitorInfo);
     Piwik_Tracker::getDatabase()->query($sql, $bind);
     $idVisit = Piwik_Tracker::getDatabase()->lastInsertId();
     $this->visitorInfo['idvisit'] = $idVisit;
     $this->visitorInfo['visit_first_action_time'] = $this->getCurrentTimestamp();
     $this->visitorInfo['visit_last_action_time'] = $this->getCurrentTimestamp();
     Piwik_PostEvent('Tracker.saveVisitorInformation.end', $this->visitorInfo);
 }
コード例 #6
0
ファイル: Visitor.php プロジェクト: nomoto-ubicast/piwik
 function getContinent()
 {
     return Piwik_ContinentTranslate(Piwik_Common::getContinent($this->details['location_country']));
 }
コード例 #7
0
 /**
  * Tries to fill in any missing information in a location result.
  * 
  * This method will try to set the continent code, continent name and country code
  * using other information.
  * 
  * Note: This function must always be called by location providers in getLocation.
  * 
  * @param array $location The location information to modify.
  */
 public function completeLocationResult(&$location)
 {
     // fill in continent code if country code is present
     if (empty($location[self::CONTINENT_CODE_KEY]) && !empty($location[self::COUNTRY_CODE_KEY])) {
         $countryCode = strtolower($location[self::COUNTRY_CODE_KEY]);
         $location[self::CONTINENT_CODE_KEY] = Piwik_Common::getContinent($countryCode);
     }
     // fill in continent name if continent code is present
     if (empty($location[self::CONTINENT_NAME_KEY]) && !empty($location[self::CONTINENT_CODE_KEY])) {
         $continentCode = strtolower($location[self::CONTINENT_CODE_KEY]);
         $location[self::CONTINENT_NAME_KEY] = Piwik_Translate('UserCountry_continent_' . $continentCode);
     }
     // fill in country name if country code is present
     if (empty($location[self::COUNTRY_NAME_KEY]) && !empty($location[self::COUNTRY_CODE_KEY])) {
         $countryCode = strtolower($location[self::COUNTRY_CODE_KEY]);
         $location[self::COUNTRY_NAME_KEY] = Piwik_Translate('UserCountry_country_' . $countryCode);
     }
     // deal w/ improper latitude/longitude & round proper values
     if (!empty($location[self::LATITUDE_KEY])) {
         if (is_numeric($location[self::LATITUDE_KEY])) {
             $location[self::LATITUDE_KEY] = round($location[self::LATITUDE_KEY], self::GEOGRAPHIC_COORD_PRECISION);
         } else {
             unset($location[self::LATITUDE_KEY]);
         }
     }
     if (!empty($location[self::LONGITUDE_KEY])) {
         if (is_numeric($location[self::LONGITUDE_KEY])) {
             $location[self::LONGITUDE_KEY] = round($location[self::LONGITUDE_KEY], self::GEOGRAPHIC_COORD_PRECISION);
         } else {
             unset($location[self::LONGITUDE_KEY]);
         }
     }
 }
コード例 #8
0
ファイル: Visit.php プロジェクト: Doluci/tomatocart
 /**
  * In the case of a new visit, we have to do the following actions:
  * 
  * 1) Insert the new action
  * 
  * 2) Insert the visit information
  */
 private function handleNewVisit()
 {
     printDebug("New Visit.");
     /**
      * Get the variables from the REQUEST 
      */
     // Configuration settings
     $userInfo = $this->getUserSettingsInformation();
     // General information
     $localTime = Piwik_Common::getRequestVar('h', $this->getCurrentDate("H"), 'numeric') . ':' . Piwik_Common::getRequestVar('m', $this->getCurrentDate("i"), 'numeric') . ':' . Piwik_Common::getRequestVar('s', $this->getCurrentDate("s"), 'numeric');
     $serverTime = $this->getCurrentTimestamp();
     $serverDate = $this->getCurrentDate();
     if ($this->isVisitorKnown()) {
         $idcookie = $this->visitorInfo['visitor_idcookie'];
         $returningVisitor = 1;
     } else {
         $idcookie = $this->getVisitorUniqueId();
         $returningVisitor = 0;
     }
     $defaultTimeOnePageVisit = Piwik_LogStats_Config::getInstance()->LogStats['default_time_one_page_visit'];
     // Location information
     $country = Piwik_Common::getCountry($userInfo['location_browser_lang']);
     $continent = Piwik_Common::getContinent($country);
     //Referer information
     $refererInfo = $this->getRefererInformation();
     /**
      * Init the action
      */
     $action = $this->getActionObject();
     $actionId = $action->getActionId();
     printDebug("idAction = {$actionId}");
     /**
      * Save the visitor
      */
     $informationToSave = array('idsite' => $this->idsite, 'visitor_localtime' => $localTime, 'visitor_idcookie' => $idcookie, 'visitor_returning' => $returningVisitor, 'visit_first_action_time' => $this->getDatetimeFromTimestamp($serverTime), 'visit_last_action_time' => $this->getDatetimeFromTimestamp($serverTime), 'visit_server_date' => $serverDate, 'visit_entry_idaction' => $actionId, 'visit_exit_idaction' => $actionId, 'visit_total_actions' => 1, 'visit_total_time' => $defaultTimeOnePageVisit, 'referer_type' => $refererInfo['referer_type'], 'referer_name' => $refererInfo['referer_name'], 'referer_url' => $refererInfo['referer_url'], 'referer_keyword' => $refererInfo['referer_keyword'], 'config_md5config' => $userInfo['config_md5config'], '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_color_depth' => $userInfo['config_color_depth'], '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_cookie' => $userInfo['config_cookie'], 'location_ip' => $userInfo['location_ip'], 'location_browser_lang' => $userInfo['location_browser_lang'], 'location_country' => $country, 'location_continent' => $continent);
     Piwik_PostEvent('LogStats.newVisitorInformation', $informationToSave);
     $fields = implode(", ", array_keys($informationToSave));
     $values = substr(str_repeat("?,", count($informationToSave)), 0, -1);
     $this->db->query("INSERT INTO " . $this->db->prefixTable('log_visit') . " ({$fields}) VALUES ({$values})", array_values($informationToSave));
     $idVisit = $this->db->lastInsertId();
     // Update the visitor information attribute with this information array
     $this->visitorInfo = $informationToSave;
     $this->visitorInfo['idvisit'] = $idVisit;
     // we have to save timestamp in the object properties, whereas mysql eats some other datetime format
     $this->visitorInfo['visit_first_action_time'] = $serverTime;
     $this->visitorInfo['visit_last_action_time'] = $serverTime;
     /**
      * Save the action
      */
     $action->record($idVisit, 0, 0);
 }
コード例 #9
0
	/**
	 * Records one or several goals matched in this request.
	 */
	public function recordGoals($idSite, $visitorInformation, $visitCustomVariables, $action, $referrerTimestamp, $referrerUrl, $referrerCampaignName, $referrerCampaignKeyword)
	{
		$location_country = isset($visitorInformation['location_country']) 
							? $visitorInformation['location_country'] 
							: Piwik_Common::getCountry( 
										Piwik_Common::getBrowserLanguage(), 
										$enableLanguageToCountryGuess = Piwik_Tracker_Config::getInstance()->Tracker['enable_language_to_country_guess'], $visitorInformation['location_ip'] 
							);
							
		$location_continent = isset($visitorInformation['location_continent']) 
								? $visitorInformation['location_continent'] 
								: Piwik_Common::getContinent($location_country);

		$goal = array(
			'idvisit' 			=> $visitorInformation['idvisit'],
			'idsite' 			=> $idSite,
			'idvisitor' 		=> $visitorInformation['idvisitor'],
			'server_time' 		=> Piwik_Tracker::getDatetimeFromTimestamp($visitorInformation['visit_last_action_time']),
			'location_country'  => $location_country,
			'location_continent'=> $location_continent,
			'visitor_returning' => $visitorInformation['visitor_returning'],
			'visitor_days_since_first' => $visitorInformation['visitor_days_since_first'],
			'visitor_days_since_order' => $visitorInformation['visitor_days_since_order'],
			'visitor_count_visits' => $visitorInformation['visitor_count_visits'],
		
		);

		// Attributing the correct Referrer to this conversion. 
		// Priority order is as follows:
		// 1) Campaign name/kwd parsed in the JS
		// 2) Referrer URL stored in the _ref cookie
		// 3) If no info from the cookie, attribute to the current visit referrer
		
		// 3) Default values: current referrer
        $type = $visitorInformation['referer_type'];
        $name = $visitorInformation['referer_name'];
        $keyword = $visitorInformation['referer_keyword'];
        $time = $visitorInformation['visit_first_action_time'];
        
        // 1) Campaigns from 1st party cookie
		if(!empty($referrerCampaignName))
		{
			$type = Piwik_Common::REFERER_TYPE_CAMPAIGN;
			$name = $referrerCampaignName;
			$keyword = $referrerCampaignKeyword;
			$time = $referrerTimestamp;
		}
		// 2) Referrer URL parsing
		elseif(!empty($referrerUrl))
		{
			$referrer = new Piwik_Tracker_Visit_Referer();  
            $referrer = $referrer->getRefererInformation($referrerUrl, $currentUrl = '', $idSite);
            
            // if the parsed referer is interesting enough, ie. website or search engine 
            if(in_array($referrer['referer_type'], array(Piwik_Common::REFERER_TYPE_SEARCH_ENGINE, Piwik_Common::REFERER_TYPE_WEBSITE)))
            {
            	$type = $referrer['referer_type'];
            	$name = $referrer['referer_name'];
            	$keyword = $referrer['referer_keyword'];
				$time = $referrerTimestamp;
            }
		}
		$goal += array(
			'referer_type' 				=> $type,
			'referer_name' 				=> $name,
			'referer_keyword' 			=> $keyword,
			// this field is currently unused
			'referer_visit_server_date' => date("Y-m-d", $time),
		);

		$goal += $visitCustomVariables;
		
		// some goals are converted, so must be ecommerce Order or Cart Update 
		if($this->requestIsEcommerce)
		{
			$this->recordEcommerceGoal($goal, $visitorInformation);
		}
		else
		{
			$this->recordStandardGoals($goal, $action, $visitorInformation);
		}
	}