M_K
M_K

Reputation: 11

How to download the final url from the campaign level in Google Ads API using GAQL query

I am trying to get data for the conversion and the assigned final url using Google Ads API & GAQL. From what I saw, it is possible to click such a report using graphical tools, but in the API I do not see any way of combining this type of data into one report.

From the campaign level, it is not possible to simply add the final url field. https://developers.google.com/google-ads/api/fields/v7/campaign_query_builder

So my question is: \how can I get conversion data + final url from Google Ads using GAQL or AdsApp?

My current code, or rather query, looks like this:

...
var report_conversion = AdsApp.report(
  "SELECT campaign.name, " +
  "segments.conversion_action_name, " +
  "metrics.conversions, metrics.conversions_value" + 
  "FROM campaign WHERE segments.date > '2021-01-01' AND segments.date < '2021-01-31'"
);

report_conversion.exportToSheet(sheet)

Upvotes: 0

Views: 982

Answers (1)

Dave Davis
Dave Davis

Reputation: 968

Yes, the final URL is not a campaign attribute/resource. It's an attribute of an ad.

https://developers.google.com/google-ads/api/reference/rpc/v8/Ad

report_request = f'''SELECT ad.final_urls[]
                            FROM Ad'''

Think of what you're doing as querying the campaigns table, when you really want to query the Ad table. Be aware that not all metrics are available at this level.

Upvotes: 1

Related Questions