Skip to content

A pipeline for loading and transforming Facebook Ads performance data

License

Notifications You must be signed in to change notification settings

kaylon/facebook-ads-performance-pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Facebook Ads Performance Pipeline

A small mara data integration pipeline that incrementally loads the files downloaded by the mara Facebook ads performance downloader into a PostgreSQL data warehouse and transforms the data into a dimensional schema.

Pipeline

Resulting data

The pipeline (defined in facebook_ads_performance_pipeline/init.py) creates a database schema fb_dim that contains an ad_performance fact table with the dimensions time, ad and device:

DB schema

 

This is an example row of the fact table:

select * from fb_dim.ad_performance where conversions > 0 order by random() limit 1;
-[ RECORD 1 ]------+------------------
day_fk             | 20180924
ad_fk              | 23844375245730149
device_fk          | 1
impressions        | 1226
inline_link_clicks | 47
spend              | 33.47
conversions        | 8
conversion_value   | 1137.68

See Ads Insights - Parameters for a documentation of the metrics.

 

Getting started

Add

-e git+git@github.com:mara/facebook-ads-performance-pipeline.git@1.0.0#egg=facebook_ads_performance_pipeline

to the requirements.txt of your mara project. See the mara example project for details.

Make sure that your ETL contains the etl_tools/create_time_dimensions/ pipeline for creating the time.day dimension.

Then add the pipeline to your ETL with

import facebook_ads_performance_pipeline

my_pipeline.add(facebook_ads_performance_pipeline.pipeline)

About

A pipeline for loading and transforming Facebook Ads performance data

Resources

License

Stars

Watchers

Forks

Packages

No packages published