I'm trying to get an ad final url using the python sdk.
I tried all the fields but I can't manage to find one which returns the ad url. At the moment my fields are:
params = {'access_token':creds.refresh_token,
'fields':'action_values, actions, ad_name, adset_name, objective, outbound_clicks, outbound_clicks_ctr, call_to_action_clicks, campaign_name, cost_per_unique_click, cpc, cpm, spend, website_ctr, date_start, date_stop',
'action_breakdowns':['action_link_click_destination'],
'date_presets':'last_year',
# 'time_range':" since:2017-06-01, until:2017-01-03}"
}
ad_insights = requests.get("https://graph.facebook.com/v2.10/{}/insights".format(ad['id']), params=params)
I understand that some ads won't have a final url, like boosting posts, but many ads are only pointing to a site, how can I get the "call to action url" ?
You have to pull in the adCreative for each ad that AdInsights reports on. The adCreative will contain the outbound link.
See here https://developers.facebook.com/docs/marketing-api/reference/ad-creative
The following fields may be of interest to you