Appearance
Code examples
The same call — agents vs humans by channel over the last 28 days — in three languages.
bash
curl -X POST https://api.eureka-analytics.com/v1/properties/AH-1A2B3C/reports/run \
-H "Authorization: Bearer $AH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"date_range":"last_28_days","actor":"humans_and_agents",
"dimensions":["channel_group","navigation_mode"],
"metrics":["sessions","conversions","revenue"],"limit":20}'js
const res = await fetch('https://api.eureka-analytics.com/v1/properties/AH-1A2B3C/reports/run', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.AH_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
date_range: 'last_28_days',
actor: 'humans_and_agents',
dimensions: ['channel_group', 'navigation_mode'],
metrics: ['sessions', 'conversions', 'revenue'],
limit: 20,
}),
})
if (!res.ok) throw new Error((await res.json()).detail)
const { columns, rows } = await res.json()
console.table(rows.map((r) => Object.fromEntries(columns.map((c, i) => [c.id, r[i]]))))python
import os, requests
r = requests.post(
"https://api.eureka-analytics.com/v1/properties/AH-1A2B3C/reports/run",
headers={"Authorization": f"Bearer {os.environ['AH_API_KEY']}"},
json={
"date_range": "last_28_days",
"actor": "humans_and_agents",
"dimensions": ["channel_group", "navigation_mode"],
"metrics": ["sessions", "conversions", "revenue"],
"limit": 20,
},
timeout=30,
)
r.raise_for_status()
body = r.json()
for row in body["rows"]:
print(dict(zip([c["id"] for c in body["columns"]], row)))Watch agent friction every morning (Python)
python
import os, requests
API = "https://api.eureka-analytics.com/v1"
H = {"Authorization": f"Bearer {os.environ['AH_API_KEY']}"}
pid = "AH-1A2B3C"
funnels = requests.get(f"{API}/properties/{pid}/funnels", headers=H, timeout=30).json()["data"]
checkout = next(f for f in funnels if f["name"] == "Checkout funnel")
res = requests.post(f"{API}/properties/{pid}/funnels/{checkout['id']}/run", headers=H,
json={"date_range": "yesterday"}, timeout=60).json()
print(res)Try it on the demo
Use a test key (ahk_test_…) with property AH-DEMO01 to run every example on the Summit Supply demo data.