我想按数据范围进行过滤,只是为了查看每天或最后一天、上周、上月的表现。。。等
如何添加不同于start_date或end_date的日期参数,因为?我猜这些参数只是针对竞选的开始和结束日期,但它们可能不会给我想要的结果。
我的当前代码是:
from facebookads.api import FacebookAdsApi
from facebookads import objects
my_app_id = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
my_app_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
my_access_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
FacebookAdsApi.init(my_app_id, my_app_secret, my_access_token)
me = objects.AdUser(fbid='10153166606850429')
my_accounts = list(me.get_ad_accounts())
my_account = objects.AdAccount('act_XXXXXXXXXXXX')
params = {
'start_date': '2015-02-01',
}
fields = {
'impressions',
'clicks',
'spent',
}
stats = my_account.get_ad_campaign_stats(fields=fields, params=params)
# print stats
for stat in stats:
print stat