npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fb-business-page-post-insights

v1.0.0

Published

Group together many Facebook page posts

Downloads

2

Readme

fb-page-post-insights

Grab all Facebook pages that belong to a user, process their posts and run insights on them

Disclaimer - The function of this code is bespoke to BBC and is meant for transparant engineering or code reviews

Written and Tested with NodeJS v8.4.0 on macOS X 10.12.6

What is it?

A script for grouping together posts made from multiple Facebook pages.

Why create it?

I have two system accounts, each with about 120 Facebook Pages for various sub brands of the BBC. Shows like Newsnight and Victoria Darbishire have their own Facebook pages, which share a broad range of their own content, organisation content (BBC) and external content (3rd party).

I want to be able to find all the subbrand Pages that BBC content was promoted on, aggregate their engagement (shares, reactions, comments) and give the creater of that content an idea of how their work performed and reached people.

How does it work?

You will need a system account token (created through business manager) and app secret (the app which is assosiated to your business). Once the system account has all Page assets assigned to it, it will retireve all the Pages with thier tokens. Each page is called with their token and the last 100 posts is retuned.

In order to aggregate link shares on posts, we have to find out what the cononical id is. Luckily, we include this in the shared url. Unfortuantly, the shared url is shortened and the id is lost. So the script visits all the urls that have been shared finding the original url and extracts the cononical id from it.

The script will further filter down posts that we care about by looking at the type of id. Once we have our final list of posts we want infomation on, the object_id (post id) is sent to the insights edge and insights are returned.

Whats next?

I want to show the number of people who became fans of the page from clicking on the like button in the page post. Not where sure this end point is.

How to use

git clone https://github.com/danm/fb-business-page-post-insights.git

cd fb-business-page-post-insights

npm i

./bin/fbposts <system user token> <app secret>

Your app must have Require App Secret which on in the advanced settings. This is the same place you grab the app secret from.

Example respons

{
    "permalink_url": "https://www.facebook.com/BBCFamilyNews/posts/<postid>",
    "type": "link",
    "link": "http://www.bbc.co.uk/news/uk-politics-42078457",
    "message": "#Grangela - love it! 🙋 not 👵",
    "name": "BBC Family & Education News",
    "comments": 4,
    "shares": 2,
    "id": "<pageid>_<postid>",
    "host": "www.bbc.co.uk",
    "pathname": "/news/uk-politics-42078457",
    "reactions": {
        "like": 52,
        "love": 5,
        "wow": 3,
        "haha": 0,
        "sorry": 0,
        "anger": 0
    },
    "engagedUsers": 1410,
    "engagedFans": 1305
},..