> 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

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/business-management/ai-site-chat/statistics-v2/sample-flows.md

## Article Content:

# Wix Assistant Statistics API: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. It provides a useful starting point as you plan your implementation.

## Monitor AI Site-Chat performance metrics

You want to track how your AI Site-Chat is performing on a daily basis to understand visitor engagement patterns and identify trends in chat usage.

To monitor AI Site-Chat performance metrics:

1. Call Get Statistics with the daily KPI fields your app needs, such as `kpi_date`, `mode`, and `conversations_count`.
2. Extract the `dailyKpis` array from the response.
3. Group or filter the KPI rows by `mode` to compare AI-handled and Wix-user-handled conversations.
4. Use `kpi_date` to plot conversation trends over time.
5. Refresh the data regularly to keep dashboards up to date.

## Build analytics dashboards for chat engagement

You're creating a comprehensive dashboard that displays various AI Site-Chat metrics to help site owners understand their chat performance and visitor engagement levels.

To build analytics dashboards for chat engagement:

1. Call Get Statistics without field selectors to retrieve the default daily and period KPI fields.
2. Extract both `dailyKpis` and `periodKpis` from the statistics response.
3. Use daily KPI data to create time-series charts showing conversation trends over the last 30 days.
4. Process period KPI data to display key metrics:
   - Total conversations for `last_30_days` and `previous_30_days`
   - Visitors, exposed items, orders, replied conversations, and response-time KPIs for each period
5. Calculate percentage changes between current and previous periods for performance comparison.
6. Create visual representations (charts, graphs, summary cards) using the aggregated data.
7. Implement automatic dashboard refresh by calling the API at regular intervals.

## Compare current and historical chat performance

You need to evaluate whether your AI Site-Chat improvements are working by comparing current performance against previous periods and identifying areas for optimization.

To compare current and historical chat performance:

1. Call Get Statistics to get period-based comparison data.
2. Extract the `periodKpis` array from the response.
3. Identify the two period entries:
   - Find the entry with `period` set to `last_30_days` for current performance
   - Find the entry with `period` set to `previous_30_days` for historical baseline
4. Compare key metrics between periods:
   - Calculate conversation growth: `(current.conversations_count - previous.conversations_count) / previous.conversations_count * 100`
   - Review visitor count changes to assess reach improvements
   - Evaluate exposed items and orders to measure product recommendation effectiveness
   - Compare response-time KPIs to understand support responsiveness
5. Generate performance reports highlighting improvements or areas needing attention.
6. Use daily KPI data to identify specific dates that contributed to period-level changes.