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

# Get Referrer Stats

> Get a list of referrers and their stats.



## OpenAPI

````yaml get /website/{hostname}/referrers
openapi: 3.0.3
info:
  title: Medama Analytics API
  version: 0.5.0
  description: |
    This is the Medama Analytics OpenAPI 3.0 specification.
  contact:
    email: hello@ayuhito.com
    name: Medama Analytics
    url: https://medama.io/contact
  license:
    url: https://github.com/medama-io/medama/blob/main/core/LICENSE
    name: Apache License 2.0
servers:
  - url: http://localhost:8080
    description: Local Server
security: []
tags:
  - name: Authentication
    description: Authentication
  - name: Event
    description: Page Events
  - name: User
    description: User Management
  - name: Website
    description: Website Management
  - name: Stats
    description: Statistics
paths:
  /website/{hostname}/referrers:
    get:
      tags:
        - Stats
      summary: Get Referrer Stats
      description: Get a list of referrers and their stats.
      operationId: get-website-id-referrers
      parameters:
        - in: query
          name: grouped
          description: Whether to return the grouped aggregation name or only URLs.
          schema:
            type: boolean
            default: true
        - $ref: '#/components/parameters/SessionAuth'
        - $ref: '#/components/parameters/Hostname'
        - $ref: '#/components/parameters/Summary'
        - $ref: '#/components/parameters/PeriodStart'
        - $ref: '#/components/parameters/PeriodEnd'
        - $ref: '#/components/parameters/Path'
        - $ref: '#/components/parameters/Referrer'
        - $ref: '#/components/parameters/UTMSource'
        - $ref: '#/components/parameters/UTMMedium'
        - $ref: '#/components/parameters/UTMCampaign'
        - $ref: '#/components/parameters/Browser'
        - $ref: '#/components/parameters/OS'
        - $ref: '#/components/parameters/Device'
        - $ref: '#/components/parameters/Country'
        - $ref: '#/components/parameters/Language'
        - $ref: '#/components/parameters/PropertyName'
        - $ref: '#/components/parameters/PropertyValue'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Offset'
      responses:
        '200':
          description: OK
          headers:
            X-Api-Commit:
              $ref: '#/components/headers/X-Api-Commit'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatsReferrers'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorisedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - CookieAuth: []
components:
  parameters:
    SessionAuth:
      name: _me_sess
      in: cookie
      description: Session token for authentication.
      required: true
      schema:
        type: string
        example: _me_sess=token; Path=/; HttpOnly; SameSite=Lax; Secure
    Hostname:
      name: hostname
      in: path
      description: Hostname for the website.
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 253
        format: hostname
    Summary:
      name: summary
      in: query
      description: Return a summary of the stats.
      required: false
      schema:
        type: boolean
        default: false
    PeriodStart:
      name: start
      in: query
      description: >-
        Period start date using date-time notation in RFC3339 format, for
        example, (2017-07-21T17:32:28Z).
      required: false
      schema:
        type: string
        format: date-time
    PeriodEnd:
      name: end
      in: query
      description: >-
        Period end date using fdate-time notation in RFC3339 format, for
        example, (2017-07-21T17:32:28Z).
      required: false
      schema:
        type: string
        format: date-time
    Path:
      name: path
      in: query
      description: Path of the page.
      required: false
      style: deepObject
      explode: true
      allowReserved: true
      schema:
        $ref: '#/components/schemas/FilterString'
    Referrer:
      name: referrer
      in: query
      description: Referrer URL of the page hit.
      required: false
      style: deepObject
      explode: true
      allowReserved: true
      schema:
        $ref: '#/components/schemas/FilterString'
    UTMSource:
      name: utm_source
      in: query
      description: UTM source of the page hit.
      required: false
      style: deepObject
      explode: true
      allowReserved: true
      schema:
        $ref: '#/components/schemas/FilterString'
    UTMMedium:
      name: utm_medium
      in: query
      description: UTM medium of the page hit.
      required: false
      style: deepObject
      explode: true
      allowReserved: true
      schema:
        $ref: '#/components/schemas/FilterString'
    UTMCampaign:
      name: utm_campaign
      in: query
      description: UTM campaign of the page hit.
      required: false
      style: deepObject
      explode: true
      allowReserved: true
      schema:
        $ref: '#/components/schemas/FilterString'
    Browser:
      name: browser
      in: query
      description: Browser name.
      required: false
      style: deepObject
      explode: true
      allowReserved: true
      schema:
        $ref: '#/components/schemas/FilterString'
    OS:
      name: os
      in: query
      description: Operating system name.
      required: false
      style: deepObject
      explode: true
      allowReserved: true
      schema:
        $ref: '#/components/schemas/FilterString'
    Device:
      name: device
      in: query
      description: Device type.
      required: false
      style: deepObject
      explode: true
      allowReserved: true
      schema:
        $ref: '#/components/schemas/FilterString'
    Country:
      name: country
      in: query
      description: Country name.
      required: false
      style: deepObject
      explode: true
      allowReserved: true
      schema:
        $ref: '#/components/schemas/FilterString'
    Language:
      name: language
      in: query
      description: Language code.
      required: false
      style: deepObject
      explode: true
      allowReserved: true
      schema:
        $ref: '#/components/schemas/FilterString'
    PropertyName:
      name: prop_name
      in: query
      description: Name of the property.
      required: false
      style: deepObject
      explode: true
      allowReserved: true
      schema:
        $ref: '#/components/schemas/FilterString'
    PropertyValue:
      name: prop_value
      in: query
      description: Value of the property.
      required: false
      style: deepObject
      explode: true
      allowReserved: true
      schema:
        $ref: '#/components/schemas/FilterString'
    Limit:
      name: limit
      in: query
      description: Limit the number of results.
      schema:
        type: integer
        minimum: 1
        maximum: 5000
    Offset:
      name: offset
      in: query
      description: Offset the results paired with the limit parameter.
      schema:
        type: integer
        minimum: 0
        maximum: 5000
  headers:
    X-Api-Commit:
      description: >-
        A custom header used to identify the commit of the API. This can be used
        to force reload the client if the API has been updated.
      schema:
        type: string
        example: 97dd2ae
  schemas:
    StatsReferrers:
      type: array
      title: StatsReferrers
      items:
        type: object
        properties:
          referrer:
            type: string
            description: Referrer URL.
          visitors:
            type: integer
            description: Number of unique visitors from referrer.
          visitors_percentage:
            type: number
            description: >-
              Percentage of unique visitors from referrer relative to all
              visitors.
            format: float
          bounce_percentage:
            type: number
            description: Bounce rate percentage from referrer.
            format: float
          duration:
            type: integer
            description: Total time spent on page from referrer in milliseconds.
        required:
          - referrer
          - visitors
          - visitors_percentage
    FilterString:
      type: object
      properties:
        eq:
          type: string
          description: Equal to.
        neq:
          type: string
          description: Not equal to.
        contains:
          type: string
          description: Contains.
        not_contains:
          type: string
          description: Does not contain.
        starts_with:
          type: string
          description: Starts with.
        not_starts_with:
          type: string
          description: Does not start with.
        ends_with:
          type: string
          description: Ends with.
        not_ends_with:
          type: string
          description: Does not end with.
        in:
          type: string
          description: In.
        not_in:
          type: string
          description: Not in.
  responses:
    BadRequestError:
      description: 400 Bad Request.
      headers:
        X-Api-Commit:
          $ref: '#/components/headers/X-Api-Commit'
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                additionalProperties: false
                properties:
                  code:
                    type: integer
                    format: int32
                    default: 400
                  message:
                    type: string
                required:
                  - code
                  - message
            required:
              - error
    UnauthorisedError:
      description: 401 Unauthorised.
      headers:
        X-Api-Commit:
          $ref: '#/components/headers/X-Api-Commit'
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                additionalProperties: false
                properties:
                  code:
                    type: integer
                    format: int32
                    default: 401
                  message:
                    type: string
                required:
                  - code
                  - message
            required:
              - error
    ForbiddenError:
      description: 403 Forbidden.
      headers:
        X-Api-Commit:
          $ref: '#/components/headers/X-Api-Commit'
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                additionalProperties: false
                properties:
                  code:
                    type: integer
                    format: int32
                    default: 403
                  message:
                    type: string
                required:
                  - code
                  - message
            required:
              - error
    NotFoundError:
      description: 404 Not Found.
      headers:
        X-Api-Commit:
          $ref: '#/components/headers/X-Api-Commit'
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                additionalProperties: false
                properties:
                  code:
                    type: integer
                    format: int32
                    default: 404
                  message:
                    type: string
                required:
                  - code
                  - message
            required:
              - error
    InternalServerError:
      description: 500 Unexpected Internal Server Error.
      headers:
        X-Api-Commit:
          $ref: '#/components/headers/X-Api-Commit'
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                additionalProperties: false
                properties:
                  code:
                    type: integer
                    format: int32
                    default: 500
                  message:
                    type: string
                required:
                  - code
                  - message
            required:
              - error
  securitySchemes:
    CookieAuth:
      name: _me_sess
      in: cookie
      type: apiKey
      description: Session token for authentication.

````