Metric data not matching report

46 views
Skip to first unread message

Drift Feline

unread,
Sep 8, 2023, 3:26:13 AM9/8/23
to Google Ads API and AdWords API Forum
I have this report

Skærmbillede 2023-09-08 091357.png

I tried getting the same data (+ a little extra) from API with this and inserting it into our DB:
      string query =
                 $@"SELECT
                 metrics.all_conversions,
                 metrics.impressions,
                 metrics.clicks,
                 metrics.cost_micros,
                 segments.device,
                 segments.date
             FROM ad_group
             WHERE segments.date >= '{fromDate.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}' and segments.date <= '{toDate.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}' ";

But I don't get the same results:
Skærmbillede 2023-09-08 092153.png

Can someone tell me what's wrong with the API Query, so the API returns the same result as the report?

Ps. We have multiple accounts, and a few of them does get the same result from API as the report. So it works for a few of the account, but most is wrong.

Google Ads API Forum Advisor

unread,
Sep 8, 2023, 7:05:33 AM9/8/23
to dr...@feline.dk, adwor...@googlegroups.com

Hello,

Greetings from the Google Ads API Team.

Can you please provide us with an uncropped screenshot of the Google Ads UI which shows your CID and the data you wish to obtain via API query and the Complete logs(request and response with request ID) of your API request where you are seeing discrepancies so we can provide precise guidance and recommendations?

If you're using one of our client libraries, you may check this documentation (https://developers.google.com/google-ads/api/docs/best-practices/logging#client_library_logging) which contains links to the appropriate logging guide for each client library. For REST interface requests, you can enable logging via the curl command by using the -i flag. This will cause the tool to include the HTTP response headers in the output.

You can provide it via Reply privately to the author option. If this option is not available, then send it instead on this email address googleadsa...@google.com 

This message is in relation to case "ref:_00D1U1174p._5004Q2ojS6M:ref"

Thanks,
 
Google Logo Google Ads API Team


Google Ads API Forum Advisor

unread,
Sep 11, 2023, 2:20:58 PM9/11/23
to dr...@feline.dk, adwor...@googlegroups.com

Hi,

Thank you for your response and for providing us the requested information.

Upon checking, we've seen that you're using ad_group resource in your request. This might be the reason for the data not matching. We've tried to use the resource of customer (https://developers.google.com/google-ads/api/fields/v14/customer) to get the equal data. Upon trying the below query, we're able to get the matching data results. With that, kindly try it in your end.

"SELECT customer.id, customer.descriptive_name, segments.date, metrics.impressions, metrics.clicks FROM customer WHERE customer.id = 7778999633 AND segments.date >= '2023-09-01' AND segments.date <= '2023-09-07' ", "summaryRowSetting": "SUMMARY_ROW_WITH_RESULTS" 

Drift Feline

unread,
Sep 12, 2023, 6:39:02 AM9/12/23
to Google Ads API and AdWords API Forum
Perfect... This was exactly what I needed.

Can you (in just a few lines) tell me why [ad_group] don't return the same results as [customer]. I would expect it to some kind of join that excludes some results in ad_group, that is on customer. But isn't all ads part of an ad_group?

I got the previous query from this page:
https://developers.google.com/google-ads/api/docs/shopping-ads/reporting

I just removed the ad_group.type where condition because I want all results.  



Google Ads API Forum Advisor

unread,
Sep 13, 2023, 3:25:09 AM9/13/23
to dr...@feline.dk, adwor...@googlegroups.com
Hi,

Thank you for getting back to us. 

After reviewing your concern, I understand that you are seeking to understand the reasons behind ad_group not producing identical results as the customer. The reason why ad_group doesn't return the same results as customer is because the ad_group resource is a subset of the customer resource. This means that all ad groups are associated with a customer, but not all customers have ad groups. Some ad groups may be shared by multiple customers, and the ad_group resource does not contain all of the information that is available in the customer resource.

I hope this helps. Kindly get back to us if you have any further queries related to the Google Ads API. 
Reply all
Reply to author
Forward
0 new messages