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());


            try
            {
                using (ReportResponse response = 
reportUtilities.GetResponse())
                {
                    using (GZipStream gzipStream = new 
GZipStream(response.Stream,
                        CompressionMode.Decompress))
                    {
                        using (XmlTextReader reader = new 
XmlTextReader(gzipStream))
                        {
                            while (reader.Read())
                            {
                                switch (reader.NodeType)
                                {
                                    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;
                                            }
                                            data.Rows.Add(row);
                                        }
                                        break;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                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.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords 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/48ad59ec-596f-4f9a-9fc0-b5953b6a1ad0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • C# AdWords Repo... Chris Oh

Reply via email to