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

# Get the visits report

> A period's visits and what they went on to buy: visitors, where they came from by channel, website, campaign and affiliate, the pages they landed on, countries and devices. A sale is given to the last visit its buyer began before it, within 30 days. An order with no visit behind it (one made by hand, an invoice) counts in the totals and in none of the lists that say where sales came from.

Needs the `analytics.read` permission (Read Analytics). It is one of the heavier reads, and is counted against a smaller budget of its own: 60 a minute for each key.



## OpenAPI

````yaml /api-reference/openapi.json get /stores/{storeId}/analytics/report
openapi: 3.1.0
info:
  title: Shoply API
  version: '1'
  description: >-
    Everything a store's own server can do with a secret API key: its catalogue,
    orders, customers, marketing, finance and the rest of what the dashboard
    does. And the Customer API, which a buyer's own device asks with a token of
    theirs.
servers:
  - url: https://api.shoply.gg/v1
security:
  - apiKey: []
tags:
  - name: API key
  - name: Store
  - name: Domain
  - name: Payment methods
  - name: Analytics
  - name: Storefronts
  - name: Storefront code
  - name: Payment Routing
  - name: Custom payment methods
  - name: Products
  - name: Product pictures
  - name: Stock
  - name: Categories
  - name: Upsells
  - name: Subscriptions
  - name: Orders
  - name: Invoices
  - name: Reviews
  - name: Coupons
  - name: Coupon categories
  - name: Coupon pop-up
  - name: Sales
  - name: Blog
  - name: Search settings
  - name: Redirects
  - name: Sitemap
  - name: Cart Recovery
  - name: Email Marketing
  - name: Email Templates
  - name: Customers
  - name: Affiliates
  - name: Support Tickets
  - name: Blacklist
  - name: Fraud protection
  - name: Disputes
  - name: Finance
  - name: Tax
  - name: Expenses
  - name: Expense setup
  - name: API requests
  - name: Webhook endpoints
  - name: Webhook deliveries
  - name: Customer API
paths:
  /stores/{storeId}/analytics/report:
    get:
      tags:
        - Analytics
      summary: Get the visits report
      description: >-
        A period's visits and what they went on to buy: visitors, where they
        came from by channel, website, campaign and affiliate, the pages they
        landed on, countries and devices. A sale is given to the last visit its
        buyer began before it, within 30 days. An order with no visit behind it
        (one made by hand, an invoice) counts in the totals and in none of the
        lists that say where sales came from.


        Needs the `analytics.read` permission (Read Analytics). It is one of the
        heavier reads, and is counted against a smaller budget of its own: 60 a
        minute for each key.
      operationId: analytics.report
      parameters:
        - name: storeId
          in: path
          required: true
          description: >-
            The store's ID. A key reaches the store it was made in: `GET /key`
            answers which.
          schema:
            type: string
        - name: range
          in: query
          required: false
          description: The period.
          schema:
            type: string
            enum:
              - today
              - yesterday
              - 7d
              - 30d
              - this_week
              - last_week
              - this_month
              - last_month
              - this_year
            default: 30d
        - name: from
          in: query
          required: false
          description: >-
            The first day of a period of your own, as `YYYY-MM-DD`. With `to`,
            in place of `range`.
          schema:
            type: string
        - name: to
          in: query
          required: false
          description: Its last day, as `YYYY-MM-DD`.
          schema:
            type: string
        - name: tz
          in: query
          required: false
          description: The time zone those days are in, as an IANA name. Left out, UTC.
          schema:
            type: string
            example: Europe/Berlin
      responses:
        '200':
          description: It worked.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    nullable: true
                  code:
                    nullable: true
                  data:
                    type: object
                    properties:
                      store:
                        type: object
                        properties:
                          id:
                            type: string
                          name:
                            type: string
                          slug:
                            type: string
                      range:
                        type: object
                        properties:
                          preset:
                            type: string
                          from:
                            type: string
                          to:
                            type: string
                          days:
                            type: integer
                          timezone:
                            type: string
                          inProgress:
                            type: boolean
                      currencyCode:
                        type: string
                      totals:
                        type: object
                        properties:
                          sessions:
                            type: integer
                          visitors:
                            type: integer
                          pageViews:
                            type: integer
                          orders:
                            type: integer
                          revenue:
                            type: number
                          visitOrders:
                            type: integer
                          visitRevenue:
                            type: integer
                          viewsPerSession:
                            type: integer
                          avgEngagedSeconds:
                            type: integer
                          measuredSessions:
                            type: integer
                          bounceRate:
                            type: integer
                          cartRate:
                            type: integer
                          conversionRate:
                            type: integer
                      previous:
                        type: object
                        properties:
                          sessions:
                            type: integer
                          visitors:
                            type: integer
                          pageViews:
                            type: integer
                          orders:
                            type: integer
                          revenue:
                            type: integer
                          visitOrders:
                            type: integer
                          visitRevenue:
                            type: integer
                          viewsPerSession:
                            type: integer
                          avgEngagedSeconds:
                            type: integer
                          measuredSessions:
                            type: integer
                          bounceRate:
                            type: integer
                          cartRate:
                            type: integer
                          conversionRate:
                            type: integer
                      change:
                        type: object
                        properties:
                          sessions:
                            nullable: true
                          visitors:
                            nullable: true
                          pageViews:
                            nullable: true
                          orders:
                            nullable: true
                          revenue:
                            nullable: true
                          visitOrders:
                            nullable: true
                          visitRevenue:
                            nullable: true
                          viewsPerSession:
                            nullable: true
                          avgEngagedSeconds:
                            nullable: true
                          bounceRate:
                            nullable: true
                          cartRate:
                            nullable: true
                          conversionRate:
                            nullable: true
                      series:
                        type: object
                        properties:
                          bucket:
                            type: string
                          points:
                            type: array
                            items:
                              type: object
                              properties:
                                at:
                                  type: string
                                sessions:
                                  type: integer
                                views:
                                  type: integer
                                previousAt:
                                  type: string
                                previousSessions:
                                  type: integer
                                previousViews:
                                  type: integer
                      pages:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
                          distinct:
                            type: integer
                          views:
                            type: integer
                          coversFrom:
                            type: string
                          retentionDays:
                            type: integer
                      landing:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
                          distinct:
                            type: integer
                      exit:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
                          distinct:
                            type: integer
                      channels:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
                          distinct:
                            type: integer
                      referrers:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
                          distinct:
                            type: integer
                      devices:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
                          distinct:
                            type: integer
                      browsers:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
                          distinct:
                            type: integer
                      systems:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
                          distinct:
                            type: integer
                      campaigns:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
                          distinct:
                            type: integer
                      sources:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
                          distinct:
                            type: integer
                      campaignSales:
                        type:
                          - array
                          - object
                      engines:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
                          sessions:
                            type: integer
                      affiliates:
                        type:
                          - array
                          - object
                      countries:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
                          distinct:
                            type: integer
                      cities:
                        type: object
                        properties:
                          rows:
                            type:
                              - array
                              - object
              example:
                success: true
                message: null
                code: null
                data:
                  store:
                    id: 743d82fb-6aad-44bb-ab00-d54c4b0eecb7
                    name: Northwind Keys
                    slug: northwind
                  range:
                    preset: 30d
                    from: '2026-09-23'
                    to: '2026-10-22'
                    days: 30
                    timezone: UTC
                    inProgress: true
                  currencyCode: USD
                  totals:
                    sessions: 0
                    visitors: 0
                    pageViews: 0
                    orders: 5
                    revenue: 167.98
                    visitOrders: 0
                    visitRevenue: 0
                    viewsPerSession: 0
                    avgEngagedSeconds: 0
                    measuredSessions: 0
                    bounceRate: 0
                    cartRate: 0
                    conversionRate: 0
                  previous:
                    sessions: 0
                    visitors: 0
                    pageViews: 0
                    orders: 0
                    revenue: 0
                    visitOrders: 0
                    visitRevenue: 0
                    viewsPerSession: 0
                    avgEngagedSeconds: 0
                    measuredSessions: 0
                    bounceRate: 0
                    cartRate: 0
                    conversionRate: 0
                  change:
                    sessions: null
                    visitors: null
                    pageViews: null
                    orders: null
                    revenue: null
                    visitOrders: null
                    visitRevenue: null
                    viewsPerSession: null
                    avgEngagedSeconds: null
                    bounceRate: null
                    cartRate: null
                    conversionRate: null
                  series:
                    bucket: day
                    points:
                      - at: '2026-09-23'
                        sessions: 0
                        views: 0
                        previousAt: '2026-08-24'
                        previousSessions: 0
                        previousViews: 0
                      - at: '2026-09-24'
                        sessions: 0
                        views: 0
                        previousAt: '2026-08-25'
                        previousSessions: 0
                        previousViews: 0
                  pages:
                    rows: []
                    distinct: 0
                    views: 0
                    coversFrom: '2026-09-23'
                    retentionDays: 90
                  landing:
                    rows: []
                    distinct: 0
                  exit:
                    rows: []
                    distinct: 0
                  channels:
                    rows: []
                    distinct: 0
                  referrers:
                    rows: []
                    distinct: 0
                  devices:
                    rows: []
                    distinct: 0
                  browsers:
                    rows: []
                    distinct: 0
                  systems:
                    rows: []
                    distinct: 0
                  campaigns:
                    rows: []
                    distinct: 0
                  sources:
                    rows: []
                    distinct: 0
                  campaignSales: []
                  engines:
                    rows: []
                    sessions: 0
                  affiliates: []
                  countries:
                    rows: []
                    distinct: 0
                  cities:
                    rows: []
        '401':
          $ref: '#/components/responses/NoKey'
        '403':
          $ref: '#/components/responses/NotAllowed'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooMany'
      x-codeSamples:
        - lang: javascript
          label: Node.js
          source: |
            import Shoply from "@shoplygg/node";

            const shoply = new Shoply({ apiKey: process.env.SHOPLY_API_KEY });

            const result = await shoply.analytics.report();
        - lang: php
          label: PHP
          source: |
            <?php

            require 'vendor/autoload.php';

            $shoply = new Shoply\Client(['apiKey' => getenv('SHOPLY_API_KEY')]);

            $result = $shoply->analytics->report();
        - lang: python
          label: Python
          source: |
            import shoply

            client = shoply.Client()  # reads SHOPLY_API_KEY

            result = client.analytics.report()
components:
  responses:
    NoKey:
      description: >-
        No API key was sent, or the one sent is not a live key:
        `api_key_required`, `invalid_api_key`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Refusal'
    NotAllowed:
      description: >-
        The key is real and may not do this: `missing_scope` (with
        `requiredScope`), `ip_not_allowed`, `account_unavailable`, or
        `dashboard_only` for something only a person in the dashboard may do.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Refusal'
    NotFound:
      description: >-
        There is no such thing in this store: `not_found`. A store that is not
        the key's own is answered the same way.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Refusal'
    TooMany:
      description: >-
        The key has used up its budget for now: `rate_limited`. `Retry-After`
        says how many seconds to wait.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Refusal'
  schemas:
    Refusal:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          description: What is wrong, in words for a person.
        code:
          type: string
          description: What is wrong, as a word that does not change.
        data:
          nullable: true
        errors:
          type: object
          description: >-
            For `validation_failed`: what is wrong with each field, by the
            field's name.
          additionalProperties:
            type: string
      required:
        - success
        - message
        - code
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        A secret API key, made under Developers in the dashboard:
        `Authorization: Bearer shoply_sk_...`

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.