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

# Track Frontend Event

> Capture a frontend-initiated analytics event.

``body.event_type`` selects the PostHog event name; the remaining fields
on the validated model become the event's properties. Telemetry failures
are isolated so they never bubble up to the user's primary action.



## OpenAPI

````yaml /openapi/openhands-cloud.json post /api/analytics/events
openapi: 3.1.0
info:
  title: OpenHands
  description: 'OpenHands: Code Less, Make More'
  version: 0.0.1
servers: []
security: []
paths:
  /api/analytics/events:
    post:
      tags:
        - Analytics
      summary: Track Frontend Event
      description: |-
        Capture a frontend-initiated analytics event.

        ``body.event_type`` selects the PostHog event name; the remaining fields
        on the validated model become the event's properties. Telemetry failures
        are isolated so they never bubble up to the user's primary action.
      operationId: track_frontend_event_api_analytics_events_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePrButtonClickedEvent'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsEventResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    CreatePrButtonClickedEvent:
      properties:
        event_type:
          type: string
          const: create pr button clicked
          title: Event Type
        git_provider:
          anyOf:
            - type: string
              enum:
                - github
                - gitlab
                - bitbucket
                - bitbucket_data_center
                - azure_devops
                - forgejo
                - enterprise_sso
            - type: 'null'
          title: Git Provider
      type: object
      required:
        - event_type
      title: CreatePrButtonClickedEvent
      description: |-
        ``create pr button clicked``: Pull Request button click in chat UI.

        Drives PostHog surveys (e.g. NPS) keyed off the PR action. The event
        name uses the lowercase-with-spaces convention shared by every other
        PostHog event in ``openhands/analytics/analytics_constants.py``.
    AnalyticsEventResponse:
      properties:
        status:
          type: string
          title: Status
      type: object
      required:
        - status
      title: AnalyticsEventResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-Access-Token

````