Tuesday, June 13, 2017

Facebook Marketing API Set action_attribution_windows No views

Leave a Comment

When using the Facebook marketing api i would like to download the actions without the action_attribution_windows 1d_view option.

I currently use the following setup;

# Ad import fields fields = [     # Ad meta data     Insights.Field.account_id,     Insights.Field.account_name,     Insights.Field.campaign_id,     Insights.Field.campaign_name,     Insights.Field.adset_id,     Insights.Field.adset_name,     Insights.Field.ad_id,     Insights.Field.ad_name,     Insights.Field.date_start,     Insights.Field.date_stop,     # Ad metrics     Insights.Field.cpc,     Insights.Field.cpm,     Insights.Field.cpp,     Insights.Field.ctr,      Insights.Field.impressions,     Insights.Field.reach,     Insights.Field.spend,     Insights.Field.inline_link_clicks,      Insights.Field.clicks,     Insights.Field.actions      ]  # Ad parameters params_ad = {     'level': Insights.Level.ad,      'limit': limit if limit > 0 else None,     'time_range': {         'since': since,         'until': until     },     'action_attribution_windows': ['28d_click'], }  # Download data from Facebook my_insights = my_account.get_insights(fields=fields, params=params_ad) 

This however downloads the data as 28d_click with 1d_view. As i think it defaults at 1d_view when no value is given.

How would i disable the 1d_view?

1 Answers

Answers 1

How would i disable the 1d_view?

You can't, you would need to specify the number of days if you use action_attribution_windows otherwise as you guessed, it would default to 1d_view

From the docs, action_attribution_windows can be given custom day parameters as it is a: list

However you can specify 7d_view, 28d_view if you don't need 1d_view.

We measure the actions that occur when a conversion event occurs and look back in time 1-day, 7-days, and 28 days

Reference:

https://developers.facebook.com/docs/marketing-api/reference/ad-account/insights/

https://developers.facebook.com/docs/marketing-api/insights/v2.9

Please comment for more information.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment