facebook / facebook-python-business-sdk

Python SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
1.29k stars 636 forks source link

can't get custom offsite conversions using async request on insights api #430

Closed VikramTiwari closed 6 years ago

VikramTiwari commented 6 years ago

Using normal requests I can get various custom offsite conversions but for the same query when run as async and try to download csv, it doesn't return those custom conversion columns.

This is happening while using CURL requests as well.

You can use this URL as GET to get the data in response, or as POST to request a report_run_id which you can use to get all the data. https://graph.facebook.com/v2.11/<act_id>/insights?access_token=<token>&time_range={since: '2017-06-05',until:'2017-06-05'}&time_increment=1&fields=spend,ad_id,ad_name,actions&export_format=["csv"]&level=ad

GET response gives the data and custom conversions, but is a longer, not great process. POST is good but doesn't give custom conversions.

lintaocui commented 6 years ago

You need to include the custom custom columns in the 'export_columns' field.

Examples: export_columns:["date_start","date_stop","campaign_name","campaign_delivery","results","objective_results_indicator","reach","impressions","cost_per_result","adset_budget_value","adset_budget_type","spend","campaign_end","actions:offsite_conversion.custom.126684351342231"] export_format:csv export_name:Dell MPP MF, Campaigns, Jan 1, 2018 – Jan 22, 2018 fields:["campaign_name","campaign_delivery","results","reach","impressions","cost_per_result","adset_budget_value","adset_budget_type","spend","campaign_end","actions"] filtering:[{"field":"campaign.impressions","operator":"GREATER_THAN","value":0}]

lintaocui commented 6 years ago

If you still see the issue, please include detailed repro steps, include ad account id, and exactly curl calls. access token is not required

VikramTiwari commented 6 years ago

Request report run:

curl -X POST "https://graph.facebook.com/v2.11/act_10150570516600254/insights?access_token=<token>&time_range={since: '2017-12-06',until:'2017-12-06'}&time_increment=1&fields=spend,ad_id,ad_name,actions&export_columns=['spend','ad_id','ad_name','actions','actions:offsite_conversion.custom.1508941229412002']&export_format=['csv']&level=ad"

This gives me the report ID which I download using:

curl -X GET https://www.facebook.com/ads/ads_insights/export_report/?report_run_id=212913932611288&format=csv&access_token=<token>&format=csv

The column is still not there. Please reopen the issue.

Also, why is it required that I pass the exact column name? actions:offsite_conversion.custom.* should always be included in the report the same way reporting start date is included.

@lintaocui Please don't close issues pre-emptively.

VikramTiwari commented 6 years ago

@lintaocui Any update on this issue?

JackByte commented 6 years ago

Same problem. Did you have any luck @VikramTiwari ?

Edit: We found a solution! https://developers.facebook.com/support/bugs/359198321155085/?disable_redirect=0

"in your export query, you need to explicitly specify the custom conversions needed using 'export_columns' param. Something like: https://www.facebook.com/ads/ads_insights/export_report/?report_run_id=&format=csv&export_columns[0]=ad_id&export_columns[1]=ad_name&export_columns[2]=spend&export_columns[3]=actions:offsite_conversion.custom.1508941229412002&access_token=&format=csv"

I hope this helps!