Hi
I am using ReportDefinitionService version v201008. When I try to
generate the report for multiple campaigns or adgroups, the xml
returned doesn't get statistics info. However, when I specify single
adgroupId or campaignid in the Predicate, it retrieves the statistics
information.
Older version (v13) allowed us to specify multiple campaignIds. I
don't want to make seperate api call for each campaign or adgroups. I
want to pass number of campaignIds and generate report.
Here is my code which works on one campaignId. I want to pass in an
array of campaignIds but api doesn't return any stats. I tried
passing in multiple campaignId to one Predicate instance. I also
tried creating new instance of Predicate for each separate campaignid
but it returns the same results (i.e no stats data)
Please shed some light:
public List<ReportDefinition> GenerateCampaignKeywordReport(string
campaignId, string minDate, string maxDate, string reportName, string
folderPath, ref XmlDocument reportXml)
{
List<Predicate> predicates = new List<Predicate>();
Predicate predicate = GetPredicate("CampaignId", new
string[] { campaignId }, PredicateOperator.EQUALS);
Predicate predicate2 = GetPredicate("CampaignStatus", new
string[] { "DELETED" }, PredicateOperator.NOT_EQUALS);
Predicate predicate3 = GetPredicate("AdGroupStatus", new
string[] { "DELETED" }, PredicateOperator.NOT_EQUALS);
Predicate predicate4 = GetPredicate("Status", new string[]
{ "DELETED" }, PredicateOperator.NOT_EQUALS);
predicates.Add(predicate);
predicates.Add(predicate2);
predicates.Add(predicate3);
predicates.Add(predicate4);
return GenerateReport(minDate, maxDate,
keywordReportFields, reportName, folderPath,
ReportDefinitionReportType.KEYWORDS_PERFORMANCE_REPORT, reportXml,
predicates);
}
private List<ReportDefinition> GenerateReport(string minDate,
string maxDate, string[] fields, string reportName, string folderPath,
ReportDefinitionReportType reportType, XmlDocument reportXml,
List<Predicate> predicates)
{
Selector selector = GetReportSelector(minDate, maxDate,
fields, predicates.ToArray());
ReportDefinition reportDefinition =
GetReportDefinition(selector, reportName, reportType, true,
ReportDefinitionDateRangeType.CUSTOM_DATE, DownloadFormat.XML);
ReportDefinitionOperation reportOperation =
GetOperation(reportDefinition, Operator.ADD);
List<ReportDefinitionOperation> defList = new
List<ReportDefinitionOperation>();
defList.Add(reportOperation);
List<ReportDefinition> mutatedDefinitions =
Mutate(defList);
if (mutatedDefinitions.Count >= 1)
{
ReportUtilities utility = new ReportUtilities(user);
string reportFile = folderPath + reportName + ".xml";
utility.DownloadReportDefinition(mutatedDefinitions[0].id,
reportFile);
reportXml.Load(reportFile);
}
return mutatedDefinitions;
}
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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