Facebook Ads

Introduction

Facebook Ads Insights API provides users a single consistent way to extract ads metrics from Facebook.

Use case

Users in their Data Pipeline can retrieve metrics for specified campaign, add set or ad id using Insights API.

User Stories

  • As a data pipeline user, I would like to be able to pull metrics for specified campaign, add set or add id, transform it and load it into my analytics data warehouse, so that I can use it for analytics

  • As a data pipeline user, I would like to be able to specify breakdowns, so I can group metrics by specified parameters

  • As a data pipeline user, I would like to be able to specify fields to pull, so I can selectively retrieve required metrics

  • As a data pipeline user, I would like to be able to specify filters, so I can selectively retrieve required metrics

  • As a data pipeline user, I would like to be able to specify date range[s], so I can pull metrics only for specified time span[s]

  • As a data pipeline user, I would like CDAP's Facebook Ads Insights plugins to handle API limits, by exposing required properties, so that I do not have to worry about them

Plugin Type

  • Batch Source
  • Batch Sink 
  • Real-time Source
  • Real-time Sink
  • Action
  • Post-Run Action
  • Aggregate
  • Join
  • Spark Model
  • Spark Compute

Configurables

This section defines properties that are configurable for this plugin. 

User Facing NameTypeDescriptionConstraints
Access tokenstring Access token
Object TypeselectOne of Campaign, Add set, Ad or Account
Campaign IDstring Campaign IDDisplayed only if appropriate "Object Type" selected
Ad Set IDstring Ad Set IDDisplayed only if appropriate "Object Type" selected
Ad IDstring Ad IDDisplayed only if appropriate "Object Type" selected
Account IDstring Account IDDisplayed only if appropriate "Object Type" selected
LevelselectLevel of request
Fields multi-selectList of fields to pull
Breakdown selectList of breakdowns
Additional BreakdownselectList of additional breakdownsCan be ignored if primary breakdown does not support additional breakdown
Filteringfunction-dropdown-with-alias
List of per-field filters
Time Rangeselect
Relative time range
SortingselectField to sort results
Sorting Directionradio-groupSorting direction - ascending or descending

For “Filter” and “Time Ranges” string formats see facebook doc, “filtering” and “time_ranges” parameters respectively.

Design / Implementation Tips

Plugin will be implemented using official facebook-java-business-sdk, authentication will be performed using app secret and access token. Output schema must be automatically generated from selected fields and breakdowns. 


Output schema completely based on Fields items. Fields that holds action or list of actions is a nullable action record or nullable array of records respectively; other fields are nullable strings.

Reference

https://developers.facebook.com/docs/marketing-api/insights

Table of Contents

Checklist

  • User stories documented 
  • User stories reviewed 
  • Design documented 
  • Design reviewed 
  • Feature merged 
  • Examples and guides 
  • Integration tests 
  • Documentation for feature 
  • Short video demonstrating the feature