I'm getting Keyword data with KeywordReport, and formatting it in XML.
I'm using PHP. What is strange – I get keywords, which don't exist and
never existed. For example, if I have campaign with name "Microsoft
First Content network banners", then i get some keywords with text
"Content", but in MCC this keyword never existed. So my data is not
real. I'm using official PHP library. (Retrieved data was ok, until
yesterday.)
Here is XML Object, what i get:
[1388]=>
object(SimpleXMLElement)#1428 (1) {
["@attributes"]=>
array(18) {
["day"]=>
string(10) "2011-01-01"
["campaignID"]=>
string(8) "50157851"
["campaign"]=>
string(35) "Microsoft First Content network banners"
["adGroupID"]=>
string(10) "1734709571"
["adGroup"]=>
string(8) "LV group"
["keywordText"]=>
string(7) "Content"
["matchType"]=>
string(5) "Broad"
["firstPageCPC"]=>
string(4) "0.00"
["qualityScore"]=>
string(1) "0"
["maxCPC"]=>
string(2) "--"
["impressions"]=>
string(3) "495"
["clicks"]=>
string(1) "1"
["ctr"]=>
string(5) "0.20%"
["avgCPC"]=>
string(4) "0.04"
["cost"]=>
string(4) "0.04"
["avgPosition"]=>
string(3) "1.0"
["avgCPM"]=>
string(4) "0.08"
["keywordState"]=>
string(7) "enabled"
}
}
Here is code I use:
// Get the GetReportDefinitionService.
$reportDefinitionService = $user-
>GetReportDefinitionService('v201008');
// Create selector.
$selector = new Selector();
($startdate != $enddate) ? $selector->dateRange =
new DateRange((string) $startdate,
(string) $enddate) :
$selector->dateRange =
new DateRange((string) $startdate,
(string) $startdate);
$selector->fields = array('Date', 'CampaignId',
'CampaignName', 'AdGroupId',
'AdGroupName', 'KeywordText', 'KeywordMatchType',
'FirstPageCpc',
'QualityScore', 'ProxyMaxCpc', 'Impressions',
'Clicks', 'Ctr',
'AverageCpc', 'Cost', 'AveragePosition', 'AverageCpm',
'Status');
// Create report definition.
$reportDefinition = new ReportDefinition();
$reportDefinition->reportName = 'Ad performance report
#' . time();
$reportDefinition->dateRangeType = 'CUSTOM_DATE';
$reportDefinition->reportType =
'KEYWORDS_PERFORMANCE_REPORT';
$reportDefinition->downloadFormat = 'XML';
$reportDefinition->selector = $selector;
// Create operations.
$operation = new ReportDefinitionOperation();
$operation->operand = $reportDefinition;
$operation->operator = 'ADD';
$operations = array($operation);
// Add report definition.
$result = $reportDefinitionService->mutate($operations);
$array = Array();
// Display report definitions.
if ($result != null)
foreach ($result as $reportDefinition) {
$xml =
ReportUtils::DownloadReport($reportDefinition->id, $path
= null, $user); // get the Report
in XML
$xmlobj = simplexml_load_string($xml);
}
return $xmlobj;
I'm confused with this, please help.
Thanks!
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en