smallest duration possible for pulling campaign ads cost information?

157 views
Skip to first unread message

Steve Begin

unread,
Feb 8, 2024, 6:43:37 PM2/8/24
to Google Ads API and AdWords API Forum
Hello,

Is there a way to request Google Ads data from the Google Ads API for a smaller duration than a day? I realize that requests for a day during that day will give less since the day is not yet complete. I am just meaning to inquire if there is a lesser duration possible to pass in. This is especially since I do see lesser than a day available in the Google Ads web GUI.

Currently this is the searchStream query I am using:

SELECT campaign.name, campaign.id, metrics.cost_micros, metrics.impressions FROM campaign WHERE segments.date BETWEEN '{startDateString}' AND '{endDateString}'

Thanks in advance for your help.

Steve Begin

unread,
Feb 9, 2024, 6:59:37 AM2/9/24
to Google Ads API and AdWords API Forum
Please note: I am specifically asking the question I wrote as it pertains to cost data, which seems to be primarily if not only ascertained via the metrics.cost_micros of the campaign resource.The concern at this point is that it seems there is no way to retroactively collect our cost and impression information for any data points that were less than a day if we happen to ever encounter any unexpected interruption/s.

Google Ads API Forum Advisor

unread,
Feb 9, 2024, 9:27:10 AM2/9/24
to steveb...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

Apologies for the confusion. You can use segments.hour to fetch the data of a shorter duration than a day. I would recommend you to check this guide on reporting for an example that uses segments.hour in the GAQL query.

I hope this helps.

 
This message is in relation to case "ref:!00D1U01174p.!5004Q02ryyKy:ref"

Thanks,
 
Google Logo Google Ads API Team


Steve Begin

unread,
Feb 9, 2024, 1:15:36 PM2/9/24
to Google Ads API and AdWords API Forum
Thank you for your help and clarification; I was able to successfully retrieve a given hour after I adjusted the GAQL query for my .net code to:

SELECT campaign.name, campaign.id, metrics.cost_micros, metrics.impressions, segments.hour FROM campaign WHERE segments.date BETWEEN '{startDateString}' AND '{endDateString}' AND segments.hour = {startHourToCaptureString}

Just to be absolutely certain then: there is no shorter duration than hour that I may get retroactively, correct?

Google Ads API Forum Advisor

unread,
Feb 9, 2024, 5:19:35 PM2/9/24
to steveb...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

Your understanding is correct that the GAQL queries currently don't support retrieving data for durations shorter than an hour retroactively. While you can use segments.hour to get hourly data, there's no equivalent segment for minutes or seconds available.

Steve Begin

unread,
Feb 9, 2024, 5:51:18 PM2/9/24
to Google Ads API and AdWords API Forum
Thanks. I'm all set on this now. I appreciate the guidance.
Reply all
Reply to author
Forward
0 new messages