Why does FB Insights API return different values but the same dates when segmenting by days_28 / week / day / lifetime?

StackOverflow https://stackoverflow.com/questions/21483406

Question

These 3 API calls all return values for essentially the same dates (Jan-1st - Jan-30th).

/50813163906/insights/page_impressions_paid_unique/week?since=1388552400&until=1391144400

/50813163906/insights/page_impressions_paid_unique/day?since=1388552400&until=1391144400

/50813163906/insights/page_impressions_paid_unique/days_28?since=1388552400&until=1391144400

However the values for each date are hugely different.

  • /week gives

    {value: 635756,end_time:"2014-01-01"},,{value: 479251,end_time: "2014-01-02"},{value: 396633,end_time: "2014-01-03"}...

  • /day gives

    {value: 110598,end_time:"2014-01-01"},{value: 458,end_time: "2014-01-02"},{value: 4,end_time: "2014-01-03"}...

  • /days_28 gives

    {value: 411634,end_time:"2014-01-01"},{value: 407725,end_time: "2014-01-02"},{value: 403430,end_time: "2014-01-03"}...

what are these date segments supposed to total up and from when to when?

Was it helpful?

Solution

I'm pretty sure that the values given are totals for the end date dependant on your segmenting .

For example, the segment /week returns:

{value: 635756,end_time: "2014-01-01"}
{value: 479251,end_time: "2014-01-02"}
{value: 396633,end_time: "2014-01-03"}

Which means:

For the 7 days prior to & ending on *2014-01-01* there were 635756 impressions
For the 7 days prior to & ending on *2014-01-02* there were 479251 impressions
For the 7 days prior to & ending on *2014-01-03* there were 396633 impressions

The segment /day returns:

{value: 110598, end_time: "2014-01-01"}
{value: 458,    end_time: "2014-01-02"}
{value: 4,      end_time: "2014-01-03"}

Which means:

For the day *2014-01-01* there were 110598 impressions
For the day *2014-01-02* there were 458    impressions
For the day *2014-01-03* there were 4      impressions

The segment /days_28 returns:

{value: 411634, end_time: "2014-01-01"}
{value: 407725, end_time: "2014-01-02"}
{value: 403430, end_time: "2014-01-03"}

Which means:

For the 28 days prior to & ending on *2014-01-01* there were 411634 impressions
For the 28 days prior to & ending on *2014-01-02* there were 407725 impressions
For the 28 days prior to & ending on *2014-01-03* there were 403430 impressions

These numbers look to be about right, but your 28 days numbers seem smaller than your week numbers which is strange. Maybe that has something to do with the since & until limits that you're putting on the GET request.

If you want the true numbers for a month, it's probably best to do by day and take the individual values and using the paging next / previous values that are returned as part of the results to help you navigate backwards until you reach the first of the month.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top