Marketing analytics pipeline
Synthetic data. Runs in daily CI.
Meta Ads and Google Ads exports modelled against shop-attributed orders and revenue, built on synthetic data.
- google_
ads_ campaign_ daily - meta_
ads_ insights - campaign_
mapping - shop_
orders
- stg_
google_ ads_ _ campaign_ daily - stg_
meta_ ads_ _ adset_ daily - stg_
shop_ _ orders
- int_
ad_ spend_ _ campaign_ daily - int_
orders_ _ attributed
- fct_
campaign_ performance_ daily - mart_
channel_ weekly
The number on a node counts the tests attached to it. A relationship test is counted on both models it touches, so the numbers add up to more than the 37 tests in total.
What it is
A pipeline that puts the conversions reported by Meta Ads and Google Ads next to the orders the shop can trace. It models ad spend against shop-attributed orders and revenue, so that budget decisions can rest on them.
The data is synthetic. A generator makes exports for a fictional skincare brand: 180 days, 6 campaigns and about 7,000 orders. No client data is involved. Any figure the pipeline produces shows the method, not a finding.
My role
This is my own project. I built it alone.
How it was built
It is built with Python, SQL and dbt on DuckDB. Raw exports are loaded as text. Staging models type and clean them. An intermediate layer attributes orders by last-click UTM through a campaign mapping kept by hand. Two marts come out: campaign performance per day and a weekly summary per channel.
The diagram is drawn from the dbt manifest of the project: 3 sources, 1 seed, 7 models and 37 tests. Three of the tests are custom: spend reconciles with the raw data, paid UTMs are mapped, and attributed revenue stays within total revenue. pytest and the full pipeline run on every push and every day at 06:00 UTC.
What was tried and dropped
Nothing yet. The history is three commits. Still open on the roadmap: a dashboard, a walkthrough video, a postmortem, other attribution models and a way to ask the data questions in plain language.
Where it stands
It works on synthetic data and runs in daily CI. The repository is public on GitHub.
What I learned
The platforms and the shop never share a key, so the mapping between them is the real work. Tests that reconcile totals catch more than tests on single columns.
