> ## Documentation Index
> Fetch the complete documentation index at: https://sitegpt.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get analytics

> Get daily engagement analytics: widget opens, conversations, messages, reactions, unique visitors, escalations, and leads, with totals and a prior-period comparison. Requires analytics to be enabled for the account (403 ANALYTICS_LOCKED otherwise); insight-derived counters appear only when insights is enabled.

Required scope: `chatbots:read`.

On success, `data` contains: `analytics`.



## OpenAPI

````yaml https://sitegpt.ai/api/v2/openapi.json get /api/v2/chatbots/{chatbotId}/analytics
openapi: 3.1.0
info:
  title: SiteGPT Agent API
  version: 2.0.0
  description: >-
    Agent-facing API for managing SiteGPT chatbots, dashboard summaries,
    appearance media, knowledge, settings, conversations, leads, members,
    account profiles, usage, billing reads, and API tokens.
servers:
  - url: https://sitegpt.ai
security:
  - bearerAuth: []
tags:
  - name: Discovery
  - name: Onboarding
  - name: Account
  - name: Billing
  - name: Tokens
  - name: Chatbots
  - name: Knowledge
  - name: Knowledge Sync Jobs
  - name: Knowledge Sources
  - name: Custom Responses
  - name: Personas
  - name: Instructions
  - name: Settings
  - name: Conversation Starters
  - name: Conversation Followups
  - name: Members
  - name: Leads
  - name: Conversations
  - name: Messages
  - name: Tags
paths:
  /api/v2/chatbots/{chatbotId}/analytics:
    get:
      tags:
        - Chatbots
      summary: Get analytics
      description: >-
        Get daily engagement analytics: widget opens, conversations, messages,
        reactions, unique visitors, escalations, and leads, with totals and a
        prior-period comparison. Requires analytics to be enabled for the
        account (403 ANALYTICS_LOCKED otherwise); insight-derived counters
        appear only when insights is enabled.


        Required scope: `chatbots:read`.


        On success, `data` contains: `analytics`.
      operationId: getChatbotAnalytics
      parameters:
        - name: chatbotId
          in: path
          required: true
          description: Chatbot ID.
          schema:
            type: string
        - name: startDay
          in: query
          required: false
          description: >-
            First UTC day of the range (YYYY-MM-DD). Defaults to a trailing
            30-day window ending at endDay.
          schema:
            type: string
            format: date
        - name: endDay
          in: query
          required: false
          description: >-
            Last UTC day of the range (YYYY-MM-DD). Defaults to today (UTC). The
            range spans at most 366 days.
          schema:
            type: string
            format: date
      responses:
        '200':
          description: Successful SiteGPT API v2 response.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                  - meta
                properties:
                  ok:
                    type: boolean
                    const: true
                  data:
                    type: object
                    additionalProperties: true
                    properties:
                      analytics:
                        $ref: '#/components/schemas/ChatbotAnalytics'
                  meta:
                    $ref: '#/components/schemas/AgentResponseMeta'
                additionalProperties: false
              example:
                ok: true
                data:
                  analytics:
                    startDay: '2026-07-28'
                    endDay: '2026-08-26'
                    insightsEnabled: true
                    days:
                      - day: '2026-08-26'
                        widgetOpens: 42
                        messages: 18
                        aiMessages: 18
                        positiveReactions: 3
                        negativeReactions: 0
                        threadsStarted: 9
                        uniqueVisitors: 8
                        escalations: 1
                        leads: 2
                        unansweredTurns: 1
                        sentimentNegative: 1
                        resolvedByAi: 6
                        handedOff: 1
                        classifiedThreads: 7
                    totals:
                      widgetOpens: 1180
                      messages: 640
                      aiMessages: 640
                      positiveReactions: 88
                      negativeReactions: 6
                      threadsStarted: 240
                      uniqueVisitors: 210
                      escalations: 14
                      leads: 31
                      unansweredTurns: 12
                      sentimentNegative: 9
                      resolvedByAi: 180
                      handedOff: 22
                      classifiedThreads: 205
                    prior:
                      widgetOpens: 1050
                      messages: 590
                      aiMessages: 590
                      positiveReactions: 74
                      negativeReactions: 9
                      threadsStarted: 221
                      uniqueVisitors: 195
                      escalations: 17
                      leads: 26
                      unansweredTurns: 15
                      sentimentNegative: 11
                      resolvedByAi: 160
                      handedOff: 25
                      classifiedThreads: 188
                meta:
                  requestId: request-id
        '400':
          $ref: '#/components/responses/AgentError'
        '401':
          $ref: '#/components/responses/AgentError'
        '403':
          $ref: '#/components/responses/AgentError'
        '404':
          $ref: '#/components/responses/AgentError'
        '405':
          $ref: '#/components/responses/AgentError'
      security:
        - bearerAuth:
            - chatbots:read
components:
  schemas:
    ChatbotAnalytics:
      type: object
      description: >-
        Daily engagement series with totals and a prior-period comparison.
        Requires analytics to be enabled for the account.
      additionalProperties: true
      required:
        - startDay
        - endDay
        - insightsEnabled
        - days
        - totals
        - prior
      properties:
        startDay:
          type: string
          format: date
        endDay:
          type: string
          format: date
        insightsEnabled:
          type: boolean
          description: Whether insight-derived counters are included for this account.
        days:
          type: array
          description: 'Dense series: one entry per UTC day in the range.'
          items:
            allOf:
              - $ref: '#/components/schemas/AnalyticsCounters'
              - type: object
                properties:
                  day:
                    type: string
                    format: date
        totals:
          $ref: '#/components/schemas/AnalyticsCounters'
        prior:
          $ref: '#/components/schemas/AnalyticsCounters'
          description: >-
            Totals for the prior period of equal length, ending the day before
            startDay.
    AgentResponseMeta:
      type: object
      required:
        - requestId
      properties:
        requestId:
          type: string
        warnings:
          type: array
          items:
            type: string
        nextCursor:
          type:
            - string
            - 'null'
      additionalProperties: true
    AnalyticsCounters:
      type: object
      description: >-
        Daily engagement counters. Insight-derived fields (sentimentNegative,
        resolvedByAi, handedOff, classifiedThreads) are omitted when the account
        does not have insights enabled.
      additionalProperties: true
      properties:
        widgetOpens:
          type: integer
          description: >-
            Widget sessions opened (an empty conversation is created on open;
            reopening in the same visit counts once). Recorded since 2026-07-26.
        messages:
          type: integer
          description: Visitor messages sent.
        aiMessages:
          type: integer
          description: AI replies sent.
        positiveReactions:
          type: integer
        negativeReactions:
          type: integer
        threadsStarted:
          type: integer
          description: Conversations that received a first message.
        uniqueVisitors:
          type: integer
        escalations:
          type: integer
        leads:
          type: integer
        unansweredTurns:
          type: integer
          description: Turns the chatbot could not answer.
        sentimentNegative:
          type: integer
          description: Insight counter — present only when insights is enabled.
        resolvedByAi:
          type: integer
          description: Insight counter — present only when insights is enabled.
        handedOff:
          type: integer
          description: Insight counter — present only when insights is enabled.
        classifiedThreads:
          type: integer
          description: Insight counter — present only when insights is enabled.
    AgentError:
      type: object
      required:
        - ok
        - error
        - meta
      properties:
        ok:
          type: boolean
          const: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details: {}
          additionalProperties: false
        meta:
          type: object
          required:
            - requestId
          properties:
            requestId:
              type: string
          additionalProperties: true
      additionalProperties: false
  responses:
    AgentError:
      description: SiteGPT agent API error response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AgentError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: SiteGPT API token

````