Google Ads API - How to get all campaigns that are created via google ads api (Node JS)
I am trying to find the total cost of google ads campaigns that are created via a particular manager account or via google ads api.
I tried the change event query where it gives me all the campaigns created via google ads but the issue is with change_event.change_date_time
. It requires this filter otherwise it throws an error. Because of this filter, I am only getting campaigns that are created in this specific time period, but I need all campaigns.
SELECT change_event.campaign FROM change_event WHERE campaign.status != 'REMOVED' AND change_event.change_date_time >= '${from_date}' AND change_event.change_date_time <= '${to_date}' AND change_event.client_type = 'GOOGLE_ADS_API' ORDER BY change_event.change_date_time ASC LIMIT 10000
Reference Link: https://developers.google.com/google-ads/api/fields/v9/change_event_query_builder
Unfortunately, change_event can only go retrieve data up to 30 days old (see here).
I've tried building a query that could get that information but using FROM campaign but it seems like only change_event has access to how a campaign was created.
A possible solution would be to create multiple from/to date on 30-day cycles, starting from the account creation date.
Otherwise, you can use change status for a slightly larger window of 90 days, with the limitation that you can't filter by change_event.client_type = 'GOOGLE_ADS_API', using simply change_status.resource_status = 'ADDED' instead.
SELECT change_status.campaign FROM change_status WHERE campaign.status != 'REMOVED' AND change_status.resource_status = 'ADDED' AND change_status.last_change_date_time >= '${from_date}' AND change_status.last_change_date_time <= '${to_date}' ORDER BY change_status.last_change_date_time ASC LIMIT 10000