Performance analytics tools
- get_discovery_performance: Get the metric cards for one Performance dashboard tab: overall, site search, category, or products.
- get_discovery_trend: Get a daily time series for a dashboard tab or a single query, category, product, or brand.
get_discovery_performance
Returns the metric cards from one tab of the Performance dashboard. Choose the tab with tab:
overall: All site traffic, as on the Overall tab. The metric keys arerevenue,rpv,aov,conversion_rate,visits,atc, andconversions.search: Traffic that came through site search, as on the Site search tab. Alongside the four KPIs, you get the engagement metrics that explain them:visits,browse_sessions,bounced_sessions,bounce_rate,product_page_views,atc,atc_rate, andconversions.category: Traffic on category pages, as on the Category tab. It reports the same metric set assearch, so you can put the two channels side by side over an identical window.products: Product-driven traffic, as on the Products tab. The metric keys are the four KPIs plusvisits,product_page_views,atc,atc_rate, andconversions.
Every metric arrives three ways:
- The current value.
- The comparison-period value.
- The percent change between them.
The backend computes the KPIs, so revenue, revenue per visit, average order value, and conversion rate need no derivation on your side. The products tab counts metrics per product, so a visit or order that involves several products counts under each of them. Its revenue and conversions run higher than the overall tab's, so don't compare the two directly.
On the overall tab, set breakdown to true to add the dashboard's card footers: the share of overall revenue, visits, add-to-cart, and conversions that came through site search and through category pages, plus each channel's AOV, conversion rate, and RPV. The values arrive as formatted strings, as on the dashboard. If one channel's breakdown can't be retrieved, that channel carries an error and the cards still return.
To restrict the search, category, or products tab to a subset of queries, categories, or products, apply a custom scope. Pass scope_conditions with inline conditions, joined with OR like the dashboard's custom scope modal, or pass saved_scope_id to reuse a scope saved in the dashboard. Get saved scope IDs from list_discovery_saved_filters. The overall tab takes no custom scope. Set device_type on any tab when a mobile-versus-desktop gap is what you're investigating.
Date windows anchor to the last date your account has data for, so results match the dashboard's data availability range. By default you get a rolling 30-day window compared against the 30 days immediately before it. Pass start_date with end_date to set an exact current period, and compare_start_date with compare_end_date to choose what it compares against. The window field in the response shows the exact dates queried.
To scope results to one storefront, pass site_group_id. Results then cover only that group's member sites, and site_scope in the response shows which sites were applied.
WarningA request the tool rejects, such as an unparseable date, an end date before its start date, or a custom scope on the
overalltab, returnssuccessofFalsewith the reason in theerrorfield instead of raising. Read theerrorfield when a call fails.
Request parameters
| Name | Type | Required? | Description |
|---|---|---|---|
environment | str | No | The target environment: production (default) or staging. The value is case-insensitive, and surrounding whitespace is trimmed. Staging-only accounts always resolve to staging, regardless of this value. |
tab | str | No | The dashboard tab: overall, search, category, or products. Defaults to overall. |
account_name | str | null | No | The account name. Auto-selected when you have exactly one account. Use list_discovery_accounts to see available accounts. |
site_group_id | str | int | null | No | A site group ID (numeric) or site group name. This is the recommended way to scope results to a storefront: results are filtered to the group's member sites. Defaults to -1 (account level). Use list_discovery_sites to discover site groups. |
days | int | No | The rolling window in days, from 1 to 730, ending on the last available date. Defaults to 30. Ignored when you pass start_date and end_date. |
domain_key | str | null | No | The domain key for one site, for example 'your_domain_com'. Overrides the site group's scope. Valid by itself for a site with no view ID. Use the exact domainKey from list_discovery_sites. |
view_id | str | null | No | The view ID for one site, for example '472'. Pass it with domain_key, and only when list_discovery_sites shows a viewId for that site. A wrong view ID returns the wrong data or none. |
start_date | str | null | No | The start of a custom current period, as YYYYMMDD or YYYY-MM-DD. Pass it with end_date to override days. The period can span up to 730 days. |
end_date | str | null | No | The end of a custom current period. Pass it with start_date. An end date before the start date is rejected. |
compare_start_date | str | null | No | The start of a custom comparison period. Pass it with compare_end_date to override the automatic comparison window. The period can span up to 730 days. |
compare_end_date | str | null | No | The end of a custom comparison period. Pass it with compare_start_date. An end date before the start date is rejected. |
device_type | str | null | No | Restrict every card to one device: desktop, mobile, tablet, or other (other and unknown devices). Omit for all devices combined. |
scope_conditions | list[dict] | null | No | An inline custom scope: a list of {property, operator, values} conditions joined with OR. Properties: query on the search tab, category (a cat_id) on the category tab, and prod_id or brand on the products tab. Operators: is, is_any_of, is_not, contains, and does_not_contain. Not available on the overall tab. Can't be combined with saved_scope_id. |
saved_scope_id | str | null | No | The UUID of a saved custom scope from list_discovery_saved_filters with kind set to scope. Can't be combined with scope_conditions. |
breakdown | bool | No | overall tab only. Set to true to add the site search and category share of the overall numbers under breakdown. Defaults to false. |
Response parameters
The tool returns a CompassResponse object with the following parameters:
| Parameter | Type | Description |
|---|---|---|
success | bool | Whether the request succeeded. |
data | dict | null | The normalized metric cards. |
error | str | null | Error message if the request failed, including the reason the request was rejected. |
environment_used | str | null | The environment actually queried: production or staging. This can differ from the environment you requested, because staging-only accounts always resolve to staging. |
The data object has the following fields:
| Field | Type | Description |
|---|---|---|
tab | str | The tab that was queried. |
current | dict | Each metric's value for the current period, keyed by metric name. |
previous | dict | The same metrics for the comparison period. |
trends | dict | The period-over-period percent change for each metric. |
breakdown | dict | Returned when breakdown is true. Holds a search and a category record, each with type, revenue_share, visits_share, atc_share, conversions_share, aov, conversion_rate, and rpv as formatted strings. A channel that couldn't be retrieved carries error instead. |
window | dict | The exact date ranges queried, as ISO dates: start_date, end_date, compare_start_date, and compare_end_date. |
site_scope | dict | The site scope applied: site_group_id, domain_keys, view_ids, and account_level, which is true when no site filter was applied. |
meta | dict | Report metadata, including the report ID and the date ranges the backend used. |
get_discovery_trend
Returns a daily time series, like the metrics chart in the Performance dashboard. Choose how to plot it with compare:
periods(default): One metric, set withmetric, with the current period and the comparison period as parallel series you can overlay on a chart. Each series is a list of{cdate, <metric>}records, so the two periods align day for day even when their calendar dates differ.metrics: One or two metrics, set withmetrics, over the current period only, like the dashboard's Compare metrics chart. This mode takes no comparison dates.
Choose the dashboard tab with tab. Valid tab values are overall, search, category, and products, and each tab accepts the metric keys listed for it under get_discovery_performance. To plot a single item instead, as on its detail page, pass entity and value: a query's text, a category's cat_id, a product's prod_id, or a brand. The tool then ignores tab. Copy value from a get_discovery_performance_table row, because matching is exact and case-sensitive. When an item's series comes back empty and the value's casing is the likely cause, the response includes a hint.
The search, category, and products tabs accept a custom scope through scope_conditions or saved_scope_id, and every call accepts device_type. Date handling and site scope work the same way as in get_discovery_performance. A request the tool rejects, such as an unknown tab, more than two metrics, or entity without value, returns success of False with the valid options.
Request parameters
| Name | Type | Required? | Description |
|---|---|---|---|
environment | str | No | The target environment: production (default) or staging. The value is case-insensitive, and surrounding whitespace is trimmed. Staging-only accounts always resolve to staging, regardless of this value. |
tab | str | No | The tab to plot: overall, search, category, or products. Defaults to overall. Ignored when you pass entity. |
metric | str | No | The metric to plot when compare is periods, for example visits or conversion_rate. Defaults to revenue. |
compare | str | No | The chart mode: periods for one metric against the comparison period, or metrics for up to two metrics over the current period. Defaults to periods. |
metrics | list[str] | null | No | One or two metrics to plot together when compare is metrics, for example ['visits', 'conversions']. |
entity | str | null | No | The kind of item to plot: query, category (by cat_id), product (by prod_id), or brand. |
value | str | int | null | No | The item to plot, exactly as returned by get_discovery_performance_table. Matching is case-sensitive, and brands keep their stored mixed case. Required when you pass entity. |
account_name | str | null | No | The account name. Auto-selected when you have exactly one account. Use list_discovery_accounts to see available accounts. |
site_group_id | str | int | null | No | A site group ID (numeric) or site group name. This is the recommended way to scope results to a storefront: results are filtered to the group's member sites. Defaults to -1 (account level). Use list_discovery_sites to discover site groups. |
days | int | No | The rolling window in days, from 1 to 730, ending on the last available date. Defaults to 30. Ignored when you pass start_date and end_date. |
domain_key | str | null | No | The domain key for one site, for example 'your_domain_com'. Overrides the site group's scope. Valid by itself for a site with no view ID. Use the exact domainKey from list_discovery_sites. |
view_id | str | null | No | The view ID for one site, for example '472'. Pass it with domain_key, and only when list_discovery_sites shows a viewId for that site. A wrong view ID returns the wrong data or none. |
start_date | str | null | No | The start of a custom current period, as YYYYMMDD or YYYY-MM-DD. Pass it with end_date to override days. The period can span up to 730 days. |
end_date | str | null | No | The end of a custom current period. Pass it with start_date. An end date before the start date is rejected. |
compare_start_date | str | null | No | The start of a custom comparison period. Pass it with compare_end_date to override the automatic comparison window. The period can span up to 730 days. Not accepted when compare is metrics. |
compare_end_date | str | null | No | The end of a custom comparison period. Pass it with compare_start_date. An end date before the start date is rejected. Not accepted when compare is metrics. |
device_type | str | null | No | Restrict the series to one device: desktop, mobile, tablet, or other (other and unknown devices). Omit for all devices combined. |
scope_conditions | list[dict] | null | No | An inline custom scope: a list of {property, operator, values} conditions joined with OR. Properties: query on the search tab, category (a cat_id) on the category tab, and prod_id or brand on the products tab. Operators: is, is_any_of, is_not, contains, and does_not_contain. Not available on the overall tab. Can't be combined with saved_scope_id. |
saved_scope_id | str | null | No | The UUID of a saved custom scope from list_discovery_saved_filters with kind set to scope. Can't be combined with scope_conditions. |
Response parameters
The tool returns a CompassResponse object with the following parameters:
| Parameter | Type | Description |
|---|---|---|
success | bool | Whether the request succeeded. |
data | dict | null | The daily series. |
error | str | null | Error message if the request failed, including the reason the request was rejected. |
environment_used | str | null | The environment actually queried: production or staging. This can differ from the environment you requested, because staging-only accounts always resolve to staging. |
The data object has the following fields:
| Field | Type | Description |
|---|---|---|
compare | str | The chart mode used: periods or metrics. |
tab | str | The tab that was plotted. Returned when you didn't pass entity. |
entity | str | The kind of item that was plotted. Returned when you passed entity. |
metric | str | The metric that was plotted. Returned when compare is periods. |
current | list[dict] | The daily series for the current period, each record {cdate, <metric>}. Returned when compare is periods. |
previous | list[dict] | The daily series for the comparison period, in the same shape. Returned when compare is periods. |
series | dict | A map of each metric name to its daily records over the current period. Returned when compare is metrics. |
hint | str | Returned when an item's series is empty and the casing of value is the likely cause. |
window | dict | The exact date ranges queried, as ISO dates: start_date and end_date, plus compare_start_date and compare_end_date when compare is periods. |
site_scope | dict | The site scope applied: site_group_id, domain_keys, view_ids, and account_level, which is true when no site filter was applied. |
meta | dict | Report metadata, including the report ID and the date ranges the backend used. |
Updated 9 days ago

