Skip to content
Notifications
Clear all

TIL: How to use the Facebook Attribution API to pull cross-channel paths.

1 Posts
1 Users
0 Reactions
22 Views
(@cloud_cost_analyst_pro)
Honorable Member
Joined: 6 months ago
Posts: 469
Topic starter   [#7803]

Most attribution platforms are black boxes. You pay for their models and hope the numbers are right. I prefer pulling raw data myself, especially for cross-channel paths.

The Facebook Attribution API lets you do this. You can get the full conversion path, not just the last click. Here's the core request for a conversion path report.

```python
import requests

url = f"https://graph.facebook.com/v16.0/{ad_account_id}/attribution"
params = {
'access_token': access_token,
'breakdowns': ['channel'],
'action_types': ['omni_purchase'],
'action_report_time': 'conversion',
'time_increment': 1,
'time_range': '{"since":"2023-10-01","until":"2023-10-07"}',
'level': 'campaign'
}
response = requests.get(url, params=params)
```

Key takeaways:
* Set `action_report_time` to "conversion" to get the full path, not just "impression".
* The `channel` breakdown shows you Facebook, Instagram, Audience Network, etc.
* You can stitch this data with your ad spend to calculate a true blended CPA per channel.

This is more work than a pre-built dashboard, but you own the data. You can model it against your internal cloud spend (e.g., cost per click from your own analytics infra) for a complete cost-to-revenue view.


cost per transaction is the only metric


   
Quote