Hi,

This is a creative use of predicates, but it would be fairly
inefficient to create a new report for every keyword.  If you change
you KeywordText Predicate to use the IN operator and then set the
values to be an array of all the keywords you want to check, then you
can use one report to get all the information.

Best,
- Eric Koleda, AdWords API Team

On Nov 15, 9:04 am, FUNKY BOY <d...@santiane.fr> wrote:
> Ok,I found it, this is how to do in PHP
>
> require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php';
> require_once 'Google/Api/Ads/AdWords/Util/ReportUtils.php';
>
> try {
> // Get AdWordsUser from credentials in "../auth.ini"
> // relative to the AdWordsUser.php file's directory.
> $user = new AdWordsUser();
>
> // Log SOAP XML request and response.
> $user->LogDefaults();
>
> // Get the GetReportDefinitionService.
> $reportDefinitionService = $user->GetReportDefinitionService('v201008');
>
> $filename = "../../../report.xml";
>
> $campaign_id =*********;
>
> // predicat
> $campaignPredicate = new Predicate();
> $campaignPredicate->field = 'CampaignId';
> $campaignPredicate->operator = 'EQUALS';
> $campaignPredicate->values = array($campaign_id);
>
> // predicat
> $keywordPredicate = new Predicate();
> $keywordPredicate ->field = 'KeywordText';
> $keywordPredicate ->operator = 'EQUALS';
> $keywordPredicate ->values = array("almerys");
>
> // selector
> $selector = new Selector();
> $selector->fields =
> array("CampaignId","KeywordText", "KeywordMatchType", "Impressions", 
> "Clicks", "Cost");
> $selector->predicates = array($keywordPredicate);
> // $selector->predicates = array($campaignPredicate);
>
> // Create report definition.
> $reportDefinition = new ReportDefinition();
> $reportDefinition->reportName = 'Keywords report #' . time();
> $reportDefinition->dateRangeType = 'TODAY';
> $reportDefinition->reportType = 'KEYWORDS_PERFORMANCE_REPORT';
> $reportDefinition->downloadFormat = 'XML';
> // $reportDefinition->downloadFormat = 'CSV';
> $reportDefinition->selector = $selector;
>
> // Create operations (puisqu'on créé un rapport)
> $operation = new ReportDefinitionOperation();
> $operation->operand = $reportDefinition;
> $operation->operator = 'ADD';
>
> $operations = array($operation);
>
> // Add report definition.
> $result = $reportDefinitionService->mutate($operations);
>
> // Display report definitions.
> if ($result != null) {
> foreach ($result as $reportDefinition) {
> printf("Report definition with name '%s' and id '%s' was added.\n",
> $reportDefinition->reportName, $reportDefinition->id);
> ReportUtils::DownloadReport($reportDefinition->id, $filename, $user);}
> } else {
>
> print "No report definitions were added.\n";}
> } catch (Exception $e) {
>
> print $e->getMessage();
>
>
>
>
>
>
>
> }

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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