> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# GetStatistics

# Package: aiSiteChat

# Namespace: WixAssistantStatistics

# Method link: https://dev.wix.com/docs/api-reference/business-management/ai-site-chat/statistics-v2/get-statistics.md

## Permission Scopes:
Innovation Lab User: SCOPE.INNOVATION_LAB.USER

## Introduction

Retrieves aggregated AI Site-Chat statistics for the authenticated site.

---

## REST API

### Schema

```
 Method: getStatistics
 Description: Retrieves aggregated AI Site-Chat statistics for the authenticated site.
 URL: https://www.wixapis.com/innovation/assistant/v2/statistics
 Method: GET
 Method parameters:
   query param name: byPeriodFields | type: array<byPeriodFields> | description: Period KPI fields to return in `statistics.periodKpis`.  Supported values: `period`, `mode`, `conversations_count`, `visitors_distinct_count`, `exposed_items_count`, `total_orders_count`, `replied_conversations_count`, `response_time_seconds_p50`, `first_response_time_seconds_p50`.  Default: All supported period KPI fields.  
   query param name: dailyFields | type: array<dailyFields> | description: Daily KPI fields to return in `statistics.dailyKpis`.  Supported values: `kpi_date`, `mode`, `conversations_count`, `visitors_distinct_count`, `exposed_items_count`, `total_orders_count`, `replied_conversations_count`, `response_time_seconds_p50`, `first_response_time_seconds_p50`.  Default: All supported daily KPI fields.  
 Return type: GetStatisticsResponse
  - name: statistics | type: Statistics | description: Aggregated AI Site-Chat statistics for the authenticated site.  
     - name: id | type: string | description: Site GUID the statistics are scoped to.  | validation: format GUID
     - name: dailyKpis | type: array | description: Daily KPI rows for the last 30 days.  Each row contains the fields requested in `dailyFields`, or all default daily KPI fields if `dailyFields` isn't provided.  | validation: maxItems 30
     - name: periodKpis | type: array | description: Period KPI rows for comparison windows.  Each row contains the fields requested in `byPeriodFields`, or all default period KPI fields if `byPeriodFields` isn't provided.  | validation: maxItems 10


```

### Examples

### Retrieve AI Site-Chat statistics
Gets selected daily and period KPI fields for AI Site-Chat performance

```curl
curl -X GET \
'https://www.wixapis.com/innovation/assistant/v2/statistics?dailyFields=kpi_date&dailyFields=mode&dailyFields=conversations_count&dailyFields=visitors_distinct_count&byPeriodFields=period&byPeriodFields=mode&byPeriodFields=conversations_count&byPeriodFields=total_orders_count&byPeriodFields=response_time_seconds_p50' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.assistantStats.statistics.getStatistics(options)
 Description: Retrieves aggregated AI Site-Chat statistics for the authenticated site.
 Method parameters:
   param name: options | type: GetStatisticsOptions  none  
        - name: dailyFields | type: array<string> | description: Daily KPI fields to return in `statistics.dailyKpis`.  Supported values: `kpi_date`, `mode`, `conversations_count`, `visitors_distinct_count`, `exposed_items_count`, `total_orders_count`, `replied_conversations_count`, `response_time_seconds_p50`, `first_response_time_seconds_p50`.  Default: All supported daily KPI fields.  
        - name: byPeriodFields | type: array<string> | description: Period KPI fields to return in `statistics.periodKpis`.  Supported values: `period`, `mode`, `conversations_count`, `visitors_distinct_count`, `exposed_items_count`, `total_orders_count`, `replied_conversations_count`, `response_time_seconds_p50`, `first_response_time_seconds_p50`.  Default: All supported period KPI fields.  
 Return type: PROMISE<GetStatisticsResponse>
  - name: statistics | type: Statistics | description: Aggregated AI Site-Chat statistics for the authenticated site.  
     - name: _id | type: string | description: Site GUID the statistics are scoped to.  | validation: format GUID
     - name: dailyKpis | type: array | description: Daily KPI rows for the last 30 days.  Each row contains the fields requested in `dailyFields`, or all default daily KPI fields if `dailyFields` isn't provided.  | validation: maxItems 30
     - name: periodKpis | type: array | description: Period KPI rows for comparison windows.  Each row contains the fields requested in `byPeriodFields`, or all default period KPI fields if `byPeriodFields` isn't provided.  | validation: maxItems 10


```

### Examples

### Retrieve AI Site-Chat statistics
Gets selected daily and period KPI fields for AI Site-Chat performance.

```javascript
import { statistics } from "@wix/assistant-stats";

async function getStatistics() {
  const response = await statistics.getStatistics({
    dailyFields: [
      "kpi_date",
      "mode",
      "conversations_count",
      "visitors_distinct_count",
    ],
    byPeriodFields: [
      "period",
      "mode",
      "conversations_count",
      "total_orders_count",
      "response_time_seconds_p50",
    ],
  });

  return response;
}

/* Promise resolves to:
 * {
 *   "statistics": {
 *     "id": "118f445d-6b84-4268-821d-7d2b9f40ac60",
 *     "dailyKpis": [
 *       {
 *         "toStartOfDay(kpi_date)": "2026-07-09T00:00:00Z",
 *         "conversations_count": 3,
 *         "visitors_distinct_count": 3,
 *         "kpi_date": "2026-07-09",
 *         "mode": "ai"
 *       }
 *     ],
 *     "periodKpis": [
 *       {
 *         "total_orders_count": 0,
 *         "conversations_count": 3,
 *         "mode": "ai",
 *         "period": "last_30_days",
 *         "response_time_seconds_p50": 0
 *       }
 *     ]
 *   }
 * }
 */

```

### getStatistics (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { statistics } from '@wix/assistant-stats';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { statistics },
  // Include the auth strategy and host as relevant
});


async function getStatistics(options) {
  const response = await myWixClient.statistics.getStatistics(options);
};
```

---