Hi Farid,
that's easy, with PHP API you can do as follow:
<?php
include dirname(__FILE__) . '/../../src/Google/Api/Ads/AdWords/Lib/
AdWordsUser.php';
include dirname(__FILE__) . '/../../src/Google/Api/Ads/AdWords/
Util/ReportUtils.php';
$user = new AdWordsUser();
$user->SetClientId( $client_id ); // Select the client
$user->LogDefaults();
$reportDefinitionService = $user-
>GetReportDefinitionService('v201008');
$operations = array();
// Create ad group predicate.
$statusPredicate = new Predicate();
$statusPredicate->field = 'Id
$statusPredicate->operator = 'EQUALS';
$statusPredicate->values = array('YOUR KEYWORD ID HERE');
// Create selector.
$selector = new Selector();
$selector->predicates = array( $statusPredicate );
$selector->fields = $keywordsFields =
array('AveragePosition'); //Get Avg. position
/* If you want other field, see here:
http://code.google.com/apis/adwords/docs/appendix/reports.html#keywords.
An example it could be $selector->fields = $keywordsFields =
array('Id', 'AdGroupId', 'KeywordText', 'Status', 'Clicks',
'Impressions', 'AverageCpc', 'AverageCpm', 'Ctr', 'AveragePosition' );
*/
// Create report definition.
$reportDefinition = new ReportDefinition();
$reportDefinition->reportName = "Keywords";
$reportDefinition->dateRangeType = $dateRangeType;
$reportDefinition->reportType = 'KEYWORDS_PERFORMANCE_REPORT';
$reportDefinition->downloadFormat = 'CSV';
$reportDefinition->selector = $selector;
// Create operations.
$operation = new ReportDefinitionOperation();
$operation->operand = $reportDefinition;
$operation->operator = 'ADD';
$operations[] = $operation;
// Add report definition.
$result = $reportDefinitionService->mutate($operations);
// Display report definitions.
if ($result != null)
// Download the report
foreach ($result as $reportDefinition) {
$csv = ReportUtils::DownloadReport($reportDefinition->id,
$path = null, $user);
$rows = explode( "\n", $csv );
for($i=2;$i<count($rows)-1;$i++)
$array[]=explode( "," , $rows[$i] );
// $array contain your keyword info
echo "<pre>";
print_r( $array );
}
?>
Best,
Federico
http://www.federicoulfo.it