Site insights
Analyze traffic and engagement metrics for your docs site.
Was this helpful?
Analyze traffic and engagement metrics for your docs site.
Was this helpful?
Was this helpful?
This API delivers insights about how visitors interact with your site, including page views and user engagement, helping you measure and optimize your content strategy.
The unique id of the organization
The unique id of the site
Events have been tracked.
POST /v1/orgs/{organizationId}/sites/{siteId}/insights/events HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 453
{
"events": [
{
"session": {
"visitorId": "text",
"sessionId": "text",
"cookies": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"ip": "text",
"userAgent": "text",
"language": "text",
"referrer": null,
"visitorAuthClaims": {
"ANY_ADDITIONAL_PROPERTY": "[Circular Reference]"
}
},
"location": {
"url": "https://example.com",
"siteSection": "text",
"siteSpace": "text",
"siteShareKey": "text",
"space": "text",
"revision": "text",
"page": "text"
},
"timestamp": "2025-08-26T20:44:16.148Z",
"type": "page_view"
}
]
}
Events have been tracked.
No content
The unique id of the organization
The unique id of the site
1000
Aggregated events in the site.
POST /v1/orgs/{organizationId}/sites/{siteId}/insights/events/aggregate HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 297
{
"select": [
{
"column": "datetime",
"interval": "hour"
}
],
"where": [
{
"column": "datetime",
"values": [
"2025-08-26T20:44:16.148Z"
]
},
{
"operator": "in"
}
],
"groupBy": [
{
"column": "datetime",
"interval": "hour"
}
],
"order": {
"by": {
"column": "datetime",
"interval": "hour"
},
"direction": "asc"
},
"range": "lastYear",
"limit": 1000
}
Aggregated events in the site.
{
"columns": [
{
"column": "datetime",
"values": [
"2025-08-26T20:44:16.148Z"
]
}
]
}
The unique id of the organization
The unique id of the site
List of visitor segments in the site.
GET /v1/orgs/{organizationId}/sites/{siteId}/insights/visitor-segments HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
List of visitor segments in the site.
{
"next": {
"page": "text"
},
"count": 1,
"items": [
{
"title": "text",
"claims": {
"ANY_ADDITIONAL_PROPERTY": "[Circular Reference]"
},
"events": 1,
"visitors": 1,
"sessions": 1
}
]
}