Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including fb-graph with all npm packages installed. Try it out:

var fbGraph = require("fb-graph")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

fb-graph v0.1.3

For Facebook graph API and Marketing Api, with normalised querying and responses

fb-graph

    npm install fb-graph --save

Usage

    var FB = require("fb-graph");
    var config = {
        token:token,
        graphV:"2.7"
    };
    // global fb query object
    var fb = new FB(config)
    var options = {
      accountId:"AcocuntID",
      startDate:"2017-01-01",
      endDate:"2017-01-02",
      dimensions:[
        "day::time_increment",
        "account_name::level",
      ],
      metrics:[
        "spend",
        "clicks",
        "purchases::actions"
      ],
      attributionWindow:["7d_click"],
      attributionType:"conversion"
    };
    fb.createAdsReport(options).run(function(err,rows){
        
    });
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free