diff --git a/references/workspace/usage-analytics.mdx b/references/workspace/usage-analytics.mdx index c87b3b19..87b42263 100644 --- a/references/workspace/usage-analytics.mdx +++ b/references/workspace/usage-analytics.mdx @@ -54,16 +54,58 @@ Query tags are metadata which is added to your data warehouse queries and gives The following query tags are sent: -| Query Tag | Detail | -| :----------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| organization_uuid | Lightdash organization unique identifier. | -| project_uuid | Lightdash project unique identifier. | -| user_uuid | User unique identifier. | -| dashboard_uuid | Dashboard unique identifier. | -| chart_uuid | Chart unique identifier. | -| explore_name | Name of the explore. | -| query_context | Which context the query was executed in.

For queries in:
- dashboards use `dashboardView`
- explore use `exploreView`
- chart use `chartView`
- sql chart use `sqlChartView` | -| user_attribute_`` | One tag per [user attribute](/references/workspace/user-attributes) value assigned to the querying user. Applies to both regular users and embed viewers, and requires no configuration. | +| Query Tag | Detail | +| :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| organization_uuid | Lightdash organization unique identifier. | +| project_uuid | Lightdash project unique identifier. | +| user_uuid | User unique identifier for the user that triggered the query. | +| explore_name | Name of the explore the query was run against. | +| chart_uuid | Chart unique identifier. Only set when the query originates from a saved chart. | +| dashboard_uuid | Dashboard unique identifier. Only set when the query originates from a dashboard. | +| saved_sql_uuid | Saved SQL chart unique identifier. Only set when a scheduled job is running a saved SQL chart. | +| scheduler_uuid | Scheduler unique identifier. Only set when the query is triggered by a scheduled delivery, alert, or Google Sheets sync. | +| scheduler_name | Human-readable name of the scheduler. Only set when the query is triggered by a scheduler. | +| job_id | Scheduler job identifier for a single run of a scheduler. Only set when the query is triggered by a scheduler. | +| app_uuid | Identifier of the external app that originated the request, taken from the app attribution header. Self-reported by the caller and used for attribution only. | +| query_context | Which context the query was executed in. See [Query contexts](#query-contexts) below for the full list of values. | +| user_attribute_`` | One tag per [user attribute](/references/workspace/user-attributes) value assigned to the querying user. Applies to both regular users and embed viewers, and requires no configuration. | + +### Query contexts + +The `query_context` tag identifies which surface triggered the query. Possible values: + +| Value | Where the query came from | +| :----------------------------- | :------------------------------------------------------------------------------------------- | +| `dashboardView` | Viewing a dashboard. | +| `autorefreshedDashboard` | Dashboard auto-refresh tick. | +| `exploreView` | Running a query from the explore view. | +| `chartView` | Viewing a saved chart. | +| `chartHistory` | Viewing a chart's version history. | +| `sqlChartView` | Viewing a saved SQL chart. | +| `sqlRunner` | Running a query from the SQL runner. | +| `viewUnderlyingData` | Viewing the underlying data behind a result cell. | +| `filterAutocomplete` | Autocomplete lookups for filter values. | +| `calculateTotal` | Calculating a column total. | +| `calculateSubtotal` | Calculating a group subtotal. | +| `metricsExplorer` | Queries from the Metrics Explorer. | +| `csvDownload` | CSV export of query results. | +| `gsheets` | Ad-hoc Google Sheets export. | +| `alert` | Scheduled alert evaluating its condition. | +| `scheduledDelivery` | Scheduled delivery running. | +| `scheduledChart` | Scheduled chart delivery. | +| `scheduledDashboard` | Scheduled dashboard delivery. | +| `scheduledGsheetsChart` | Scheduled Google Sheets sync for a chart. | +| `scheduledGsheetsDashboard` | Scheduled Google Sheets sync for a dashboard. | +| `scheduledGsheetsSqlChart` | Scheduled Google Sheets sync for a SQL chart. | +| `preAggregateMaterialization` | Building a pre-aggregate materialization. | +| `embed` | Query from an [embedded](/references/embedding) chart or dashboard. | +| `api` | Query issued through the Lightdash HTTP API. | +| `cli` | Query issued through the [Lightdash CLI](/references/lightdash-cli). | +| `ai` | Query issued by a [Lightdash AI agent](/guides/ai-agents/getting-started). | +| `mcp.run_metric_query` | `run_metric_query` tool call from the [Lightdash MCP server](/guides/ai-agents/mcp-servers). | +| `mcp.run_sql` | `run_sql` tool call from the Lightdash MCP server. | +| `mcp.search_field_values` | `search_field_values` tool call from the Lightdash MCP server. | +| `dataAppSample` | Sample query issued when previewing a data app. | ### User attribute tags