Hello, I am trying to pull in report data with the C# AdWords API in order to process it for internal use. I am using AWQL to achieve this purpose. For some reason, the cost data I am getting back from the API is incorrect, which I think is messing up other fields I need such as CPC and CPM. Following is query and the method I am using the pull in the data...
String query = "SELECT AccountDescriptiveName, CampaignName, AdGroupName, ExternalCustomerId, AdGroupStatus, " +
"Clicks, Impressions, Ctr, AverageCpc, AverageCpm, Cost, AveragePosition FROM ADGROUP_PERFORMANCE_REPORT " +
"WHERE Impressions > 0 DURING YESTERDAY";
Here, I am passing in the client that I want to pull the report from, the DataTable I am trying to store my results in, and the query string defined above as my parameters in the AppendToDataTable method.
private static void AppendToDataTable(AdWordsUser user, DataTable data, String query)
ReportUtilities reportUtilities = new ReportUtilities(user, "v201601", query,
DownloadFormat.GZIPPED_XML.ToString());
using (ReportResponse response = reportUtilities.GetResponse())
using (GZipStream gzipStream = new GZipStream(response.Stream,
CompressionMode.Decompress))
using (XmlTextReader reader = new XmlTextReader(gzipStream))
case XmlNodeType.Element: // The node is an Element.
if (reader.Name == "row")
// put the row into data table
DataRow row = data.NewRow();
while (reader.MoveToNextAttribute())
//Console.Write(reader.Name + ":" + reader.Value + ", ");
row[reader.Name] = reader.Value;
throw new System.ApplicationException("Failed to download report.", e);
For some reason, the data I pull tells me that my cost is in the hundreds of thousands just for yesterday, which can't be true, because on the AdWords Console, the total cost all time is only in the thousands for that client... The clicks and impression data looks correct though, it's just the cost and cost related fields that are messed up for some reason. I am using client library v201601 to do this. Any ideas to troubleshoot this problem would be appreciated, thank you.