Hi Farid

with PHP API you can do as follow:

<?php

$path = dirname(__FILE__) . '/../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
require_once 'Google/Api/Ads/AdWords/Util/ReportUtils.php';

// 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)
    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



On Nov 1, 10:59 pm, Farid <fparv...@gmail.com> wrote:
> Is there anyway that I can find the average positon for a keyword.

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to