Leveraging Facebook Python API for Marketing Analytics

Julien Kervizic
Hacking Analytics

--

Purpose

There is multiple purpose to leverage Facebook Advertising data:

  • Performance Measurement
  • Analytics Insight (such Attribution Modeling)
  • Customer Profile Enrichment

All of these require a different frequency or set of information from Facebook. While there are possibilities to exports campaign performance data directly from Facebook’s Ads Manager backend, the process can quickly become extremely time intensive and cumbersome if you are running operations at scale and use multiple advertising accounts.

Leveraging Facebook’s API allows us to automate the process of sourcing the data to empower these use cases. Performance monitoring can then be done on a daily level, merging the data with other channel information. Ad Spend time series can then be used to automate the training of an attribution model, and Customer Profile can then be automatically populated based on targeting information from Facebook.

API

Facebook provides an extensive API to interact with its platform and fetch the required information. They also offer a python SDK: Facebook Business Python SDK, which can be installed by the following pip command:

--

--

Julien Kervizic
Hacking Analytics

Living at the interstice of business, data and technology | Head of Data at iptiQ by SwissRe | previously at Facebook, Amazon | julienkervizic@gmail.com