Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
125 views
in Technique[技术] by (71.8m points)

php - Facebook Page/Post insights with costs

Edit: I've managed to get this far in the documentation: https://developers.facebook.com/docs/graph-api/reference/v2.5/promotion-info

However there's nothing linking to the {promotion-info-id} parameter in the docs that I could find.

I'll accept an answer with code/API references that's not specific to PHP as well.

I'm trying to fetch my users pages and posts insights which are working as expected, however I also need to receive stats such as per 1000 reached (cpm), total spent and new fan costs.

I am able to receive all user pages and posts however the insights API doesn't return any associated costs. I've looked at the Marketing API, but can't figure out how to link the pages and posts to those stats. How do I get the ad_account/ad_campaign values from posts and pages? Do I need them at all? Feeling quite lost in its API.

I also need to fetch the stats on a daily basis in order to calculate daily and monthly changes.

I can pull most daily stats using the insights API but there are no costs attached and https://developers.facebook.com/docs/graph-api/reference/v2.5/page nor https://developers.facebook.com/docs/graph-api/reference/v2.5/post offers no such thing.

$response = $this->facebook->get('/' . $pageId . '/insights?since=' . date('Y-m') . '-01', $token);
$data = $response->getGraphEdge()->asArray();

Also, is there a facebook sandbox I could use to pull dummy costs or other stats since I don't have a page that would have paid content.

question from:https://stackoverflow.com/questions/33337738/facebook-page-post-insights-with-costs

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can get the Ads Insights using the Facebook Marketing API Insights Edge. There is really many data you can crawl, but unfortunately there is no way to connect them to the posts due to the Facebook ads nature.

If you want to you can try to create ads using Marketing API Ads Managment Edge with data grabbed from your posts and than track these ads.

But there is really no other way.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...