My team has recently migrated from Parse to Facebook Analytics. We know that Facebook events are removed after 30 days so we are planning on exporting them and then storing them in our own Parse Server.
We are having problems when we are trying to export the analytics from Facebook. The problem is that every time we get the export from Facebook the file is empty. There is definitely events being logged as our product is live and we can see events occurring in the Facebook dashboard.
The exports are going to be in a cron job that is run every 2 hours and retrieves the events for the last 2 hours.
Generate request:
GENERATE_URL="https://graph.facebook.com/v2.6/"$APP_ID"/analytics_app_events_exports"
curl -sS --request POST $GENERATE_URL -F access_token=$ACCESS_TOKEN -F start_ts=$START_TS -F end_ts=$END_TS
Query request:
QUERY_URL="https://graph.facebook.com/v2.6/"$ID"?access_token="$ACCESS_TOKEN
curl -sS $QUERY_URL
Query response:
{
"start_ts": "2016-05-25T02:30:21+0000",
"end_ts": "2016-05-25T04:30:21+0000",
"status": "COMPLETED"
...
}
Download request:
DOWNLOAD_URL="https://lookaside.fbsbx.com/analytics/app_events_export/download?access_token="$ACCESS_TOKEN"&id="$ID"&filename="$FILENAME
curl -sS $DOWNLOAD_URL
Reference to FB docs: https://developers.facebook.com/docs/analytics/export
We would appreciate any suggestion on what is going wrong.