AdAccount.get_activities missing Activity item
When used this function to retrieve the activities from a given account, some activities will be missing, while the same activity can be seen through Ads Manager.
Example, account id 10153979638666861, campaign id 23842556634260383, adset id 23842556638570383, ad id 23842556818790383.
When viewing in Ads Manager, we can see the following 3 Activities:
- Ad status updated, From Active to Inactive, 03/27/2017 at 9:03pm (Tokyo Time, UTC+9:00)
- Ad status updated, From Inactive to Active, 03/27/2017 at 3:02pm (Tokyo Time, UTC+9:00)
- Ad status updated, From Active to Inactive, 03/27/2017 at 3:01am (Tokyo Time, UTC+9:00)
While retrieved through AdAccount.get_activities, we can only see the following two Activities:
- Activitity 1 from the Ads Manger,
<AdActivity> {
"event_time": "2017-03-26T18:01:18+0000",
"event_type": "update_ad_run_status",
"extra_data": "{\"old_value\":\"Active\",\"new_value\":\"Inactive\",\"campaign_id\":23842556638570383,\"type\":\"run_status\"}",
"object_id": "23842556818440383",
}
- Activitity 3 from the Ads Manger
<AdActivity> {
"event_time": "2017-03-27T12:03:07+0000",
"event_type": "update_ad_run_status",
"extra_data": "{\"old_value\":\"Inactive\",\"new_value\":\"Active\",\"campaign_id\":23842556638570383,\"type\":\"run_status\"}",
"object_id": "23842556818440383",
}
The parameters used to query the activities are as follow:
fields = [
Activity.Field.object_id,
Activity.Field.event_type,
Activity.Field.event_time,
Activity.Field.extra_data,
]
params = {
'since': '2017-03-18T12:25:23+09:00',
'until': '2017-03-29T00:40:52+0000'
}
Additionally, there will be duplicated Activity items within the results. One example would be:
<AdActivity> {
"event_time": "2017-03-21T09:16:31+0000",
"event_type": "update_ad_run_status",
"extra_data": "{\"old_value\":\"Inactive\",\"new_value\":\"Active\",\"campaign_id\":23842556638570383,\"type\":\"run_status\"}",
"object_id": "23842556818440383"
}
<AdActivity> {
"event_time": "2017-03-21T09:16:31+0000",
"event_type": "update_ad_run_status",
"extra_data": "{\"old_value\":\"Inactive\",\"new_value\":\"Active\",\"campaign_id\":23842556638570383,\"type\":\"run_status\"}",
"object_id": "23842556818440383",
}
Upon further investigation, it turns out that the missing Activity will be retrieved when not using until in params or set until to '2017-03-30'. But the affected Activity will be missing as soon as the value of until is set to '2017-03-30TT23:37:30+0000'.
This seems to indicate issue with parsing until when comparing with the missing event's time (2017-03-27T06:02:35+0000).
Probably related to #317
Hi @Liguo-AdGo thanks for reporting the issue! Tried to repro the issue, but it is difficult to repro since there are multiple events on each second or minute. https://developers.facebook.com/tools/explorer/334861563385364/?session_id=323699871394163 Having said that, SDK is one layer of Marketing API. This bug seems to be related to the behavior of APIs. Feel free to report a bug here: https://developers.facebook.com/bugs/