src/Repositories/GoogleAnalyticsRepository.php
protected function getProfileIdByTrackingId(&$analytics, $tracking_id)
	{
		$accounts = $analytics->management_accounts->listManagementAccounts();
		
		foreach ($accounts->getItems() as $item)
		{
			$account_id = $item->getId();
			if ($account_id != $tracking_id) continue;
			
			$properties = $analytics->management_webproperties->listManagementWebproperties($account_id);
			
			if (sizeof($properties->getItems()) > 0)
			{
				$items = $properties->getItems();
				$first_property_id = $items[0]->getId();
				
				$profiles = $analytics->management_profiles
					->listManagementProfiles($account_id, $first_property_id);
				
				if (sizeof($profiles->getItems()) > 0)
				{
					$items = $profiles->getItems();
					return $items[0]->getId();
				}
			}
		}
		
		return null;
	}
protected function getProfileIdByTrackingId(&$analytics, $tracking_id)
	{
		$accounts = $analytics->management_accounts->listManagementAccounts();
		
		foreach ($accounts->getItems() as $item)
		{
			$account_id = $item->getId();
			if ($account_id != $tracking_id) continue;
			
			$properties = $analytics->management_webproperties->listManagementWebproperties($account_id);
			
			if (sizeof($properties->getItems()) > 0)
			{
				$items = $properties->getItems();
				$first_property_id = $items[0]->getId();
				
				$profiles = $analytics->management_profiles
					->listManagementProfiles($account_id, $first_property_id);
				
				if (sizeof($profiles->getItems()) > 0)
				{
					$items = $profiles->getItems();
					return $items[0]->getId();
				}
			}
		}
		
		return null;
	}
protected function getProfileIdByTrackingId ( & $ analytics , $ tracking_id ) { $ accounts = $ analytics -> management_accounts -> listManagementAccounts ( ) ; foreach ( $ accounts -> getItems ( ) as $ item ) { $ account_id = $ item -> getId ( ) ; if ( $ account_id != $ tracking_id ) continue ; $ properties = $ analytics -> management_webproperties -> listManagementWebproperties ( $ account_id ) ; if ( sizeof ( $ properties -> getItems ( ) ) > 0 ) { $ items = $ properties -> getItems ( ) ; $ first_property_id = $ items [ 0 ] -> getId ( ) ; $ profiles = $ analytics -> management_profiles -> listManagementProfiles ( $ account_id , $ first_property_id ) ; if ( sizeof ( $ profiles -> getItems ( ) ) > 0 ) { $ items = $ profiles -> getItems ( ) ; return $ items [ 0 ] -> getId ( ) ; } } } return null ; }
41534519 -> 73241329
41534519 - > 73241329