I'm trying to display a bar chart that shows the performance of a Google ad between the 1st of March to the 31st of March. Each bar indicates a day in that range.

At the moment my query looks like

SELECT    ad_group_ad.ad.id,   ad_group_ad.ad.name,   metrics.average_cost FROM    ad_group_ad WHERE   segments.date BETWEEN '2021-03-01' AND '2021-03-31' AND ad_group_ad.status = 'ENABLED' 

The data I get back are totals within the range. I need the totals of each day within the range. Is there a way to get this information in one request?

Tag:google-ads-api

2 comments.

  1. Jonny Gwillim

    I found a segment that segments the data into weekly slices.

    SELECT ad_group_ad.ad.id, ad_group_ad.ad.name, metrics.average_cost, segments.week, segments.keyword.info.text FROM ad_group_ad WHERE segments.date BETWEEN '2021-03-01' AND '2021-03-31' AND ad_group_ad.status = 'ENABLED'

    https://developers.google.com/google-ads/api/fields/v6/ad_group_ad#segments.week

    segments.day is not documented but I can see on the google ads dashboard you can segment by days if the date range isn't greater than 16 days. I'm going to keep snooping around and see if I can find how that's done.

  2. Dave Davis

    You just need to add segments.date to your select.

Add a new comment.