For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Track site events

post
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
organizationIdstringRequired

A unique entity identifier

Pattern: ^[a-zA-Z0-9_-]+$
siteIdstringRequired

The unique id of the site

Body
Responses
204

Events have been tracked.

No content

post/orgs/{organizationId}/sites/{siteId}/insights/events
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: 454

{
  "events": [
    {
      "session": {
        "visitorId": "text",
        "sessionId": "text",
        "cookies": {
          "ANY_ADDITIONAL_PROPERTY": "text"
        },
        "ip": "text",
        "userAgent": "text",
        "language": null,
        "referrer": null,
        "visitorAuthClaims": "[Circular Reference]"
      },
      "location": {
        "url": "https://example.com",
        "previousUrl": null,
        "displayContext": "site",
        "siteSection": null,
        "siteSpace": null,
        "siteShareKey": null,
        "space": null,
        "revision": null,
        "page": null
      },
      "timestamp": "2026-01-01T00:00:00.000Z",
      "type": "page_view"
    }
  ]
}
204

Events have been tracked.

No content

Last updated

Was this helpful?