How to use the facebook-nodejs-business-sdk.AdsPixel function in facebook-nodejs-business-sdk

To help you get started, we’ve selected a few facebook-nodejs-business-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebookincubator / offline-conversion-file-uploader / sse_uploader / src / cli-upload.js View on Github external
function main() {
  const config = loadConfigOrExit(program.config);
  FacebookAdsApi.init(config.access_token);

  const pixel = new AdsPixel(config.pixel_id);

  const testId = program.testMode ? config.test_id : null;

  let batches = [], batch = [];
  fs.createReadStream(program.input)
      .pipe(csv())
      .on('data', data => {
        if (!isEmptyObject(data)) {
          batch.push(getEventData(data));
          if (batch.length == config.batch_size) {
            batches.push(batch);
            batch = [];
          }
        }
      })
      .on('end', async () => {