Pull Analytics Into Your Dashboard
Fetch engagement analytics from the VantageKit API to power custom dashboards and reports.
Use the analytics endpoint to pull aggregated engagement data for your deal rooms — total views, unique viewers, top documents, and daily view trends.
Fetch analytics for a deal room
curl -s "https://api.vantagekit.com/v1/deal-rooms/{id}/analytics?period=30d" \
-H "Authorization: Bearer vk_live_YOUR_API_KEY" | jqconst dealRoomId = '550e8400-e29b-41d4-a716-446655440000'
const response = await fetch(
`https://api.vantagekit.com/v1/deal-rooms/${dealRoomId}/analytics?period=30d`,
{ headers: { 'Authorization': `Bearer ${apiKey}` } }
)
if (!response.ok) {
const error = await response.json()
throw new Error(`API error ${response.status}: ${error.error?.message}`)
}
const { data } = await response.json()
console.log(`${data.totalViews} views from ${data.uniqueViewers} unique viewers`)
console.log(`Average view: ${data.avgViewDurationSeconds}s`)
console.log(`Top document: ${data.topDocuments[0]?.name}`)import requests
deal_room_id = '550e8400-e29b-41d4-a716-446655440000'
response = requests.get(
f'https://api.vantagekit.com/v1/deal-rooms/{deal_room_id}/analytics',
headers={'Authorization': f'Bearer {api_key}'},
params={'period': '30d'},
)
response.raise_for_status()
data = response.json()['data']
print(f"{data['totalViews']} views from {data['uniqueViewers']} unique viewers")
print(f"Average view: {data['avgViewDurationSeconds']}s")
print(f"Top document: {data['topDocuments'][0]['name']}")Response shape
{
"data": {
"dealRoomId": "550e8400-...",
"period": "30d",
"totalViews": 23,
"uniqueViewers": 8,
"avgViewDurationSeconds": 145,
"totalDownloads": 5,
"topDocuments": [
{ "documentId": "7c9e6679-...", "name": "Pitch Deck Q4", "views": 15, "avgDurationSeconds": 180 }
],
"topLinks": [
{ "linkId": "a1b2c3d4-...", "name": "Investor Link", "clicks": 47 }
],
"viewsOverTime": [
{ "date": "2026-04-01", "views": 3 },
{ "date": "2026-04-02", "views": 5 }
]
}
}Time periods
| Value | Description |
|---|---|
7d | Last 7 days |
30d | Last 30 days (default) |
90d | Last 90 days |
all | All time |
Building a summary across all deal rooms
async function getTeamSummary(apiKey) {
// Step 1: Fetch all deal rooms
const roomsRes = await fetch('https://api.vantagekit.com/v1/deal-rooms?per_page=100', {
headers: { 'Authorization': `Bearer ${apiKey}` },
})
if (!roomsRes.ok) throw new Error(`Failed to fetch deal rooms: ${roomsRes.status}`)
const rooms = await roomsRes.json()
// Step 2: Fetch analytics for each
const analytics = await Promise.all(
rooms.data.map(async (room) => {
const res = await fetch(
`https://api.vantagekit.com/v1/deal-rooms/${room.id}/analytics?period=30d`,
{ headers: { 'Authorization': `Bearer ${apiKey}` } }
)
if (!res.ok) throw new Error(`Failed to fetch analytics for ${room.id}: ${res.status}`)
return res.json()
})
)
// Step 3: Aggregate
return {
totalViews: analytics.reduce((sum, a) => sum + a.data.totalViews, 0),
uniqueViewers: analytics.reduce((sum, a) => sum + a.data.uniqueViewers, 0),
totalDownloads: analytics.reduce((sum, a) => sum + a.data.totalDownloads, 0),
}
}Viewer details
For individual viewer engagement profiles, use the viewers endpoint:
curl -s "https://api.vantagekit.com/v1/deal-rooms/{id}/viewers" \
-H "Authorization: Bearer vk_live_YOUR_API_KEY" | jq '.data[] | {email, totalViews, totalDurationSeconds}'