Performance analytics tools

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 are revenue, rpv, aov, conversion_rate, visits, atc, and conversions.
  • 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, and conversions.
  • category: Traffic on category pages, as on the Category tab. It reports the same metric set as search, 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 plus visits, product_page_views, atc, atc_rate, and conversions.

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.

🚧

Warning

A request the tool rejects, such as an unparseable date, an end date before its start date, or a custom scope on the overall tab, returns success of False with the reason in the error field instead of raising. Read the error field when a call fails.

Request parameters

NameTypeRequired?Description
environmentstrNoThe 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.
tabstrNoThe dashboard tab: overall, search, category, or products. Defaults to overall.
account_namestr | nullNoThe account name. Auto-selected when you have exactly one account. Use list_discovery_accounts to see available accounts.
site_group_idstr | int | nullNoA 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.
daysintNoThe 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_keystr | nullNoThe 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_idstr | nullNoThe 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_datestr | nullNoThe 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_datestr | nullNoThe end of a custom current period. Pass it with start_date. An end date before the start date is rejected.
compare_start_datestr | nullNoThe 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_datestr | nullNoThe end of a custom comparison period. Pass it with compare_start_date. An end date before the start date is rejected.
device_typestr | nullNoRestrict every card to one device: desktop, mobile, tablet, or other (other and unknown devices). Omit for all devices combined.
scope_conditionslist[dict] | nullNoAn 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_idstr | nullNoThe UUID of a saved custom scope from list_discovery_saved_filters with kind set to scope. Can't be combined with scope_conditions.
breakdownboolNooverall 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:

ParameterTypeDescription
successboolWhether the request succeeded.
datadict | nullThe normalized metric cards.
errorstr | nullError message if the request failed, including the reason the request was rejected.
environment_usedstr | nullThe 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:

FieldTypeDescription
tabstrThe tab that was queried.
currentdictEach metric's value for the current period, keyed by metric name.
previousdictThe same metrics for the comparison period.
trendsdictThe period-over-period percent change for each metric.
breakdowndictReturned 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.
windowdictThe exact date ranges queried, as ISO dates: start_date, end_date, compare_start_date, and compare_end_date.
site_scopedictThe site scope applied: site_group_id, domain_keys, view_ids, and account_level, which is true when no site filter was applied.
metadictReport 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 with metric, 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 with metrics, 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

NameTypeRequired?Description
environmentstrNoThe 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.
tabstrNoThe tab to plot: overall, search, category, or products. Defaults to overall. Ignored when you pass entity.
metricstrNoThe metric to plot when compare is periods, for example visits or conversion_rate. Defaults to revenue.
comparestrNoThe chart mode: periods for one metric against the comparison period, or metrics for up to two metrics over the current period. Defaults to periods.
metricslist[str] | nullNoOne or two metrics to plot together when compare is metrics, for example ['visits', 'conversions'].
entitystr | nullNoThe kind of item to plot: query, category (by cat_id), product (by prod_id), or brand.
valuestr | int | nullNoThe 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_namestr | nullNoThe account name. Auto-selected when you have exactly one account. Use list_discovery_accounts to see available accounts.
site_group_idstr | int | nullNoA 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.
daysintNoThe 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_keystr | nullNoThe 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_idstr | nullNoThe 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_datestr | nullNoThe 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_datestr | nullNoThe end of a custom current period. Pass it with start_date. An end date before the start date is rejected.
compare_start_datestr | nullNoThe 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_datestr | nullNoThe 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_typestr | nullNoRestrict the series to one device: desktop, mobile, tablet, or other (other and unknown devices). Omit for all devices combined.
scope_conditionslist[dict] | nullNoAn 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_idstr | nullNoThe 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:

ParameterTypeDescription
successboolWhether the request succeeded.
datadict | nullThe daily series.
errorstr | nullError message if the request failed, including the reason the request was rejected.
environment_usedstr | nullThe 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:

FieldTypeDescription
comparestrThe chart mode used: periods or metrics.
tabstrThe tab that was plotted. Returned when you didn't pass entity.
entitystrThe kind of item that was plotted. Returned when you passed entity.
metricstrThe metric that was plotted. Returned when compare is periods.
currentlist[dict]The daily series for the current period, each record {cdate, <metric>}. Returned when compare is periods.
previouslist[dict]The daily series for the comparison period, in the same shape. Returned when compare is periods.
seriesdictA map of each metric name to its daily records over the current period. Returned when compare is metrics.
hintstrReturned when an item's series is empty and the casing of value is the likely cause.
windowdictThe 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_scopedictThe site scope applied: site_group_id, domain_keys, view_ids, and account_level, which is true when no site filter was applied.
metadictReport metadata, including the report ID and the date ranges the backend used.

Did this page help you?

© Bloomreach, Inc. All rights reserved.