GoatCounter Pageviews API

The Pageviews API from GoatCounter — 1 operation(s) for pageviews.

OpenAPI Specification

goatcounter-pageviews-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: GoatCounter Exports Pageviews API
  description: The GoatCounter API can be used to manage sites, users, count pageviews, export raw data, retrieve statistics, and build custom dashboards on top of GoatCounter web analytics.
  version: '0'
  contact:
    name: GoatCounter
    url: https://www.goatcounter.com/
servers:
- url: https://goatcounter.com/api/v0
  description: Hosted GoatCounter (replace host with your site's subdomain)
security:
- bearerAuth: []
tags:
- name: Pageviews
paths:
  /count:
    post:
      summary: Count pageviews
      description: Send one or more pageview events to GoatCounter for tracking. Accepts a batch of hits per request.
      operationId: count
      tags:
      - Pageviews
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                no_sessions:
                  type: boolean
                hits:
                  type: array
                  items:
                    $ref: '#/components/schemas/Hit'
      responses:
        '202':
          description: Hits accepted.
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
components:
  schemas:
    Hit:
      type: object
      properties:
        path:
          type: string
        title:
          type: string
        ref:
          type: string
        event:
          type: boolean
        size:
          type: array
          items:
            type: number
        bot:
          type: integer
        user_agent:
          type: string
        location:
          type: string
        ip:
          type: string
        created_at:
          type: string
          format: date-time
        query:
          type: string
        session:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer