Using post method to run an export takes too much time - facebook

I developed a Facebook application and I doing some offline analytics on the data from the dashboard.
I am using the Export API described here: https://developers.facebook.com/docs/analytics/export
According your explanation the time it should take is about 1-2 hours but, I did it every day in the past week and it took me about 2 days to download each one of the exports.
My application don't have big amount of data, each export is small.
Can you please help me understand what I am doing wrong or maybe you have problem with the export service?

I have Facebook page which I sell there sport clothes.
Each day I would like to see the following parameters from the traffic:
- Timezone of the device
- Device platform - iOS,Android,PC
- Event_log_time - timestamp at which the event is logged
I make everyday POST request to https://graph.facebook.com/v2.6/[Application FBID]/analytics_app_events_exports
with the following data:
access_token = {my access token}
start_ts = timestamp, begining of the day
end_ts = timestamp, end of the day
Then, after 5 hours I make get request to https://graph.facebook.com/V2.6/[Export FBID]?access_token={app access token}.
The response I get is:
"id": "##############",
"start_ts":"***",
"end_ts": "***",
"status": "SCHEDULED",
"column_names":[***],
"event_param_names":[{"event_name":[Event name]',"param_names":[Custom param names]}]
I have noticed that only after 2 Days the respone I get for the get request to https://graph.facebook.com/V2.6/[Export FBID]?access_token={app access token}
the status is COMPLETED.
My question is why it takes to long? according to your API it should take about 1-2 hours.

Related

Google Analytics Data API online users [duplicate]

I've recently added a Google Analytics GA4 tag to a website for the purpose of counting the currently active users. Before, I could see the number of real-time users right now (I think it had a one-minute delay, but I'm not sure).
But in the new GA4, I can only see the number corresponding to 30 minutes, which is not what I needed.
I've looked around and found an option to add a time dimension of 1 minute, but it was for the old google analytics, and it didn't seem right to me.
Not sure if it's needed to provide my code for this question, but if it's a must, then I'll add it.
Edit:
#Run a realtime report to get desired metrics.
def run_realtime_report(property_id):
#Runs a realtime report on a Google Analytics 4 property.
client = BetaAnalyticsDataClient()
#Run the request.
request = RunRealtimeReportRequest(
property=f"properties/{property_id}",
metrics=[Metric(name="activeUsers")],
)
#Parse the response.
response = client.run_realtime_report(request)
...
return activeUsers
#Run the realtime report function.
def run_sample():
global property_id
return run_realtime_report(property_id)
The number of users in the last 30 minutes in GA4 is similar to the "active users on site right now" in Universal Analytics (UA). However after about 5 minutes of inactivity, UA sometimes assesses users are no longer active on the site. This realtime report was generated with pageviews in the last 5 minutes:
After 5 minutes of inactivity, the active users on site goes to zero:
In GA4, you could recreate that calculation by specifying the minutesRange in your realtime report request. This page describes the minuteRange parameter. As a JSON request, this report will only count users who were active in the last 5 minutes:
{
"metrics": [
{
"name": "activeUsers"
}
],
"minuteRanges": [
{
"startMinutesAgo": 5,
"endMinutesAgo": 0
}
]
}
This request is different from GA4 realtime reporting which highlights the "users in last 30 minutes" as the primary realtime metric:

Real time (true real time) Google Analytics (GA4) - not the last 30 minutes [duplicate]

I've recently added a Google Analytics GA4 tag to a website for the purpose of counting the currently active users. Before, I could see the number of real-time users right now (I think it had a one-minute delay, but I'm not sure).
But in the new GA4, I can only see the number corresponding to 30 minutes, which is not what I needed.
I've looked around and found an option to add a time dimension of 1 minute, but it was for the old google analytics, and it didn't seem right to me.
Not sure if it's needed to provide my code for this question, but if it's a must, then I'll add it.
Edit:
#Run a realtime report to get desired metrics.
def run_realtime_report(property_id):
#Runs a realtime report on a Google Analytics 4 property.
client = BetaAnalyticsDataClient()
#Run the request.
request = RunRealtimeReportRequest(
property=f"properties/{property_id}",
metrics=[Metric(name="activeUsers")],
)
#Parse the response.
response = client.run_realtime_report(request)
...
return activeUsers
#Run the realtime report function.
def run_sample():
global property_id
return run_realtime_report(property_id)
The number of users in the last 30 minutes in GA4 is similar to the "active users on site right now" in Universal Analytics (UA). However after about 5 minutes of inactivity, UA sometimes assesses users are no longer active on the site. This realtime report was generated with pageviews in the last 5 minutes:
After 5 minutes of inactivity, the active users on site goes to zero:
In GA4, you could recreate that calculation by specifying the minutesRange in your realtime report request. This page describes the minuteRange parameter. As a JSON request, this report will only count users who were active in the last 5 minutes:
{
"metrics": [
{
"name": "activeUsers"
}
],
"minuteRanges": [
{
"startMinutesAgo": 5,
"endMinutesAgo": 0
}
]
}
This request is different from GA4 realtime reporting which highlights the "users in last 30 minutes" as the primary realtime metric:

Kraken-API OHLC request doesn't honor the 'since' parameter

I'm trying to retrieve 3 months history of 30-minute candles from Kraken using the REST API:
https://www.kraken.com/help/api
Following the documentation, I made this POST request to URL:
https://api.kraken.com/0/public/OHLC
passing the following parameters in JSON format:
{
"pair":"EOSETH",
"interval":30,
"since":1514404800
}
where 1514404800 corresponds to the timestamp (in seconds) to the date:
27/10/2017 20H00m UTC
This is not clear from the API documentation, they call it an 'ID', but I came to this conclusion by looking to the returned values.
So I was expecting returned response with entries starting on this date. Then I would fetch subsequent entries using the last id returned.
However the first entry I get corresponds exactly to 15 days ago. Actually, if I don't pass the parameter 'since' at all, I get exactly the same result, so it seems the parameter is being ignored completely.
Maybe Kraken changed the API and this parameter 'since' was replaced by some other?
Or I missunderstood the syntax of this parameter and I'm doing something wrong?
They call it an 'ID' but you are right this is the UNIX TimeStamp.
I agree that it is not clear from the API documentation.
There is a limit in the number of results returned, see https://support.kraken.com/hc/en-us/articles/218198197-How-to-pull-all-trade-data-using-the-Kraken-REST-API
With an interval of 30 minutes you get all data from 15 days ago : https://api.kraken.com/0/public/OHLC?pair=EOSETH&since=0&interval=30
If you change the interval to 60 minutes you get data from 1 month ago : https://api.kraken.com/0/public/OHLC?pair=EOSETH&since=0&interval=60
With an interval of 1 minute you got data from less than 1 day (as stated in the article above) : https://api.kraken.com/0/public/OHLC?pair=EOSETH&since=0&interval=30
I tried and indeed you cannot get all 30 min data from 27/10/2017.
It seems the since parameter is useless once you reach the limit.
It works great if not (i.e. data from yesterday https://api.kraken.com/0/public/OHLC?pair=EOSETH&since=1517774700&interval=30).
As soon as you reach the limit the count starts from today to the past and you get only last 15 days data...
Maybe a solution is, as stated in the article, to build your own OHLC from trades data...
Try to contact the support to clarify this point (I already contacted them for another problem and they reply pretty fast).
(I'm writing this as an answer because too much text the for a comment, sorry if it does not answer your question)
This bypasses the API part of the question, but you can download historical data from their website:
https://support.kraken.com/hc/en-us/articles/360047124832-Downloadable-historical-OHLCVT-Open-High-Low-Close-Volume-Trades-data

Retrieving Microsoft Live calendar events between 2 dates

I'm currently working on requesting a list of events between 2 dates via Microsoft Live's REST API. I am able to pull back a list of events through the following request URL:
https://apis.live.net/v5.0/me/events
However, this returns a list of events that does not have any specific date frame. For example, I'd want to call a request similar to this:
https://apis.live.net/v5.0/me/events?startDate=2015-02-15&endDate=2015-03-15
I haven't been able to find any useful Microsoft documentation in their disorganized mess of "documentation", so my questions are:
1 - What changes need to be made to the first endpoint above for something like this to work?
2 - What time format does Microsoft use for this kind of request?
Thanks!
I finally found the answer in the middle of a Microsoft documentation page.
Get a limited number of events based on their starting and ending times in Coordinated Universal Time (UTC) format by using the start_time and end_time parameters
To answer my own questions:
#1 - The following endpoint works:
https://apis.live.net/v5.0/me/events?start_time=2015-02-15T00:00:00Z&end_time=2015-03-15T00:00:00Z
#2 - The time format is as follows:
yyyy-MM-dd'T'HH:mm:ss'Z'

Facebook Api Graph Pull data from a timeframe

I am new to this stuff, I am trying to use Facebook api Graph to get the data for the last 30 days and link it to Klipfolio.
I am able to pull all the data but no matter what i try I can not seam to get FB to only return all of the data not just last 30 days or 7days.
am I able to a time frame parameters?
Any help would be appreciated, this is what I have to pull all the data,
/adaccounts?fields=amount_spent
Thanks
i don't use facebook adds so i can't exactly test with data . but facebook graph api supports time based pagination of the data . read the time based pagination section at the graph api v2.2 docs page. .
it provides with until and since parameters.
A time-paginated edge supports the following parameters:
until : A Unix timestamp or strtotime data value that points to the
end of the range of time-based data.
since : A Unix timestamp or
strtotime data value that points to the start of the range of
time-based data.
i checked it with end points like
me/feed?until=10/11/2011
and it works as expected . so test the parameter for your required data .