Hi All,
I'm using Google AdWords API, and I want to get my campaign insights beaked
by Date, Age, Gender and Device.
Any advise please?
You can find bellow how I'm getting my campaign insights but without
breakdown.
AdWordsUser user = new AdWordsUser(config);
ReportQuery query = new ReportQueryBuilder()
.Select("CampaignId", "CampaignName", "Clicks",
"Impressions", "Amount", "Cost", "Ctr", "AverageCpc", "AverageCpm")
.From(ReportDefinitionReportType.CAMPAIGN_PERFORMANCE_REPORT)
.Where("CampaignStatus").In("ENABLED", "PAUSED")
.Where("CampaignId").In(campaign_ids)
.During(ReportDefinitionDateRangeType.LAST_7_DAYS)
.Build();
ReportUtilities reportUtilities = new ReportUtilities(user,
"v201809", query, DownloadFormat.GZIPPED_XML.ToString());
try
{
using (ReportResponse response =
reportUtilities.GetResponse())
{
using (GZipStream gzipStream = new
GZipStream(response.Stream, CompressionMode.Decompress))
{
using (var report = new
AwReport<CampaignReportRow>(new AwXmlTextReader(gzipStream), ""))
{
if(report != null && report.Rows != null &&
report.Rows.Count() > 0)
{
CampaignReportRow insights = new
CampaignReportRow()
{
Clicks = report.Rows.Select(R =>
R.Clicks).Sum(),
Amount = report.Rows.Select(R =>
R.Amount).Sum(),
Cost = report.Rows.Select(R =>
R.Cost).Sum(),
ImpressionReach = report.Rows.Select(R
=> R.ImpressionReach).Sum(),
Impressions = report.Rows.Select(R =>
R.Impressions).Sum(),
Ctr = report.Rows.Select(R =>
R.Ctr).Average(),
AverageCpc = report.Rows.Select(R =>
R.AverageCpc).Average(),
AverageCpm = report.Rows.Select(R =>
R.AverageCpm).Average(),
};
return insights;
}
else
{
return new CampaignReportRow();
}
}
}
}
}
catch (Exception e)
{
throw new System.ApplicationException("Failed to download
and parse report.", e);
}
Cheers,
Zied
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/f9df0537-f782-497a-9679-1caf8c1b34ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.