Marketing ops asked for "custom funnel visualization." Fathom's built-in reports didn't cut it. Their API is decent, so I built a scrappy pipeline.
Pulled session data, filtered for specific UTM campaigns, and stitched it to our internal lead stage data (stored in Postgres). Used a simple Python script to transform and push to a Grafana dashboard. The key was using Fathom's `site_id` and `hostname` filters to isolate the subdomain chaos.
```python
# core snippet - fetching & merging
import requests
import pandas as pd
# get pageviews for campaign
resp = requests.get(
'https://api.usefathom.com/v1/aggregations',
params={
'entity': 'pageview',
'entity_id': 'YOUR_SITE',
'field_grouping': 'hostname',
'filters': '[["utm_campaign","==","spring_push"]]'
},
headers={'Authorization': 'Bearer YOUR_TOKEN'}
)
# merge with internal CRM data here...
```
Now they get a real-time view of lead flow from ad click to SQL. Grafana alerts on drop-offs. Works better than their old spreadsheet voodoo.