How to include the ZERO metrics while fetching campaign metrics???

83 views
Skip to first unread message

Vijay P

unread,
Mar 20, 2024, 6:05:40 AM3/20/24
to Google Ads API and AdWords API Forum
I'm currently working on a campaign dashboard for Google Search within my project. The goal is to display date-wise metrics using a Line Graph, where the X-axis represents the date and the Y-axis encompasses metrics such as clicks, impressions, CTR (click-through rate), CPM (cost per thousand impressions), CPC (cost per click), and phone calls. The plotted lines will vary based on the dropdown selection.

However, I encountered an issue when fetching date-wise campaign metrics for the specific date range of January 23rd to January 24th using the API request provided below. The API only returns data for January 24th and does not include data for the 23rd. Nevertheless, in the summary, the aggregated values for the 23rd are included.

API Request:
Body: { "query": "SELECT campaign.id, campaign.name, campaign.start_date, campaign.end_date, metrics.impressions, metrics.clicks, metrics.average_cpc, metrics.average_cpm, metrics.ctr, metrics.phone_calls, metrics.search_impression_share, metrics.search_top_impression_share, metrics.top_impression_percentage, metrics.search_absolute_top_impression_share, metrics.cost_micros, segments.date, campaign_budget.total_amount_micros FROM campaign WHERE segments.date BETWEEN '2023-01-23' AND '2023-01-24' AND campaign.network_settings.target_google_search = true AND campaign.status IN ('ENABLED', 'PAUSED','REMOVED') ORDER BY segments.date", "summaryRowSetting": "SUMMARY_ROW_WITH_RESULTS" }

Upon comparison with the ads.google.com portal, I noticed that on January 23rd, all metrics except for phone calls had zero values. It seems that when metrics have zero values, the Google API does not provide data for that date range.

Could someone kindly guide me on how to resolve this issue?

Google Ads API Forum Advisor

unread,
Mar 20, 2024, 10:11:21 AM3/20/24
to iamvijayp...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

From the provided information, I understand that the API response for the mentioned query does not include data for the Jan 23rd. As you mentioned, all metrics except for phone calls had zero values on Jan 23rd. I would like to inform you that zero metrics entities are always excluded when a report is segmented. If you segment by date and the selected entity does not have metrics within the specified date range, no row will be returned. 

Please see this guide that covers how zero metrics are handled under different reporting conditions. 
This message is in relation to case "ref:!00D1U01174p.!5004Q02s05ee:ref" (ADR-00227999)

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages