Skip to main content

Overview

Metrics in Layers are quantifiable measurements of product performance that enable data-driven merchandising and sorting decisions. The platform supports two types of metrics, each designed for different use cases and data sources.

Metric types

LayersQL metrics

LayersQL metrics are computed from Layers’ internal analytics data, including user behavior tracked through the Storefront Pixel and search interactions. These metrics provide real-time insights into how customers engage with your products through the Layers platform. Key characteristics:
  • Built using the LayersQL query language
  • Powered by Layers’ behavioral analytics data
  • Support three datasets: products (product performance), search (search analytics), and collections (collection browsing analytics)
  • Support arithmetic expressions for calculated metrics (e.g., SUM(total_sales) + SUM(quantity_purchased))
  • Support WHERE clause filtering before aggregation (e.g., WHERE geo_country = 'US')
  • Support segmentation by dimensions (country, marketing channel, etc.) - see LayersQL Syntax for SEGMENT BY details
  • Real-time computation from search, browse, and interaction events
  • Ideal for metrics like views, add-to-carts, and search-driven conversions
Example LayersQL metric:
FROM products
SHOW SUM(total_sales)
GROUP BY product_id
SINCE -7d
This metric calculates total sales tracked by Layers over the last 7 days, grouped by product.

Variant-level metrics

LayersQL metrics can be grouped by variant_id to track performance at the variant level. This is particularly useful when combined with Variant Breakouts to sort variant tiles by their individual performance. Example variant-level metric:
FROM products
SHOW SUM(total_sales)
GROUP BY product_id, variant_id
SINCE -7d
When you include both product_id and variant_id in the GROUP BY clause, the metric tracks separate values for each variant. This enables variant-specific sorting and merchandising. Sorting behavior with variant breakouts: When a variant-level metric is used in a sort order and variant breakouts are enabled:
  • Variant tiles are sorted by their individual variant-level metric values
  • Product tiles are sorted by their product-level metric values (aggregated across all variants)
This conditional sorting ensures that variant tiles rank based on their specific performance while product tiles rank based on overall product performance, providing accurate and relevant sorting for both tile types.

Imported (ShopifyQL) metrics

Imported metrics leverage Shopify’s native analytics data through ShopifyQL queries. These metrics provide access to Shopify’s comprehensive sales data, including information not available through Layers’ analytics like returns, refunds, and detailed financial metrics. Key characteristics:
  • Built using full ShopifyQL syntax
  • Powered by Shopify’s native sales and analytics data
  • Automatically refreshed on a configurable schedule (hourly, daily, weekly)
  • Access to Shopify-specific metrics like return rates, net sales, and order values
  • Must include product_id in the query results for proper product association
Example Imported metric:
FROM sales
SHOW product_id, returned_quantity_rate
WHERE product_id IS NOT NULL
GROUP BY product_id
SINCE -7d UNTIL today
This metric imports Shopify’s return rate data for products over the last 7 days, refreshed daily. Important requirements for Imported metrics:
  • The ShopifyQL query must return a product_id column
  • Only one metric value column (besides product_id) should be returned
  • Queries must specify a refresh frequency: hourly, daily, or weekly

Segmented metrics

Segmented metrics allow you to break down performance data by audience attributes like geography or marketing channel. This enables personalized product rankings that automatically adapt to each visitor’s context.

How segmentation works

When you create a metric with segmentation, Layers stores separate values for each dimension. For example, a metric segmented by country tracks performance separately for visitors from the United States, Canada, United Kingdom, and other regions, plus an overall value as a fallback. When this metric is used in a sort order, the system automatically selects the most relevant value for each visitor. A visitor from Canada sees rankings based on Canadian performance when available, otherwise the overall performance. This happens transparently without requiring separate sort orders for each region.

Why use segmented metrics

Segmented metrics help you deliver more relevant product rankings to different audiences:
  • Geographic personalization: Show products that perform well in each visitor’s country or region
  • Marketing channel optimization: Rank products differently for visitors from paid ads versus organic search
  • Localized merchandising: Adapt rankings based on regional preferences and buying patterns
The system handles all the complexity automatically. You define the segmentation once in your metric, and it works across all sort orders that use that metric.

Fallback behavior

Segmented metrics always include an overall value as a fallback. If a visitor’s context doesn’t match any specific segment, or if a product has no data for that segment, the system uses the overall value. This ensures every visitor sees ranked results even when segment-specific data isn’t available.

Smoothing factor

When using segmented metrics in sort orders, you can configure a smoothing factor to control how segment-specific and global performance data are blended. This parameter helps balance personalization with stability. The smoothing factor determines the weight given to segment-specific data versus global data when ranking products. Lower values (1-50) prioritize segment-specific performance, making rankings more responsive to local trends. Higher values (100-200) blend in more global data, providing stability when segment data is sparse. When to adjust the smoothing factor:
  • High-traffic segments with established patterns: Use lower values (25-50) to maximize personalization
  • New or low-traffic segments: Use higher values (100-150) to maintain stable rankings until more data accumulates
  • Testing segmentation: Start with higher values (150-200) and gradually decrease as you validate segment performance
The smoothing factor is configured when adding a segmented metric to a sort order. See Sort Orders for detailed guidance on choosing appropriate values.

Learn more

What you can do with metrics

In search ranking

Certain metrics power the Engagement signal group in search ranking. The ranking model uses four product metrics — views, sales, cart sessions, and total sales over the last 7 days — as engagement sub-signals. These sub-signals influence how products are scored and ordered in search results. These metrics are automatically linked from the corresponding metric recipes (View Sessions 7d, Total Sales - Variant Level 7d, Cart Sessions 7d, and Total Sales 7d). When you create metrics from these recipes, the platform marks them as available for search ranking and keeps the data synchronized. You can adjust how much weight the engagement signal group receives relative to other signal groups (semantic, keyword, freshness, inventory) from the Ranking Relevancy page. Within the engagement group, you can also tune the relative importance of each product metric sub-signal.

In sort orders

Use metrics as sorting criteria to automatically rank products based on performance. Create weighted combinations of multiple metrics to develop sophisticated ranking algorithms that balance different business objectives. Examples:
  • Sort by recent conversion rate to surface high-performing products
  • Combine sales velocity with inventory levels for intelligent restocking
  • Weight revenue metrics alongside engagement metrics for balanced merchandising

In merchandising rules

The merchandising grid displays metric values directly on product cards, giving you real-time performance data while you arrange products. Each card shows the metrics you’ve selected, so you can make informed decisions about pinning, boosting, and grouping without switching between pages.

Choosing which metrics to display

Open Customize UI in the merchandising toolbar to select which metrics appear on product cards. You can add multiple metrics and drag them to reorder how they appear on each card. Your selections persist across sessions, so the grid remembers your preferred layout.

Which metrics are eligible

Not every metric can appear on the merchandising grid. A metric is eligible when it produces a per-product value:
  • Imported (ShopifyQL) metrics are always eligible
  • LayersQL metrics must meet all of the following:
    • Target the products dataset
    • Return a single aggregated value (one SHOW clause)
    • Be grouped by product_id or a product attribute
Metrics that aggregate across products (for example, total search volume) or return multiple values don’t resolve to a single number per product and are excluded from the merchandising grid.

Using metrics to guide decisions

With metric overlays enabled, you can:
  • Pin products with high return rates to the bottom of collections
  • Boost products with strong revenue per view in key collections
  • Demote products with declining sales velocity
  • Compare performance across products at a glance while reordering
See Create a merchandising rule for step-by-step instructions on configuring metric overlays.

Default dashboard metrics

When you create a new store, Layers automatically adds a set of pre-configured metrics to your Overview dashboard. These include aggregate metrics for search volume, orders, revenue, collection views, image search, similar products, and block recommendations — giving you immediate visibility into your storefront performance without any manual setup. Block analytics metrics track how your recommendation blocks perform, including impressions, revenue, conversion rate, click sessions, and top-performing blocks. See Metric Recipes for the full list of block analytics recipes.
Existing stores receive block analytics metrics automatically. They appear on your Overview dashboard alongside your other default metrics.

Visualization and analysis

LayersQL metrics include built-in charts for visualizing your data directly in the dashboard. You can choose from eight chart types — including line, bar, area, donut, and card — to display trends, comparisons, and distributions. Metrics also calculate automatic prior period comparisons, showing percentage changes over time without requiring additional configuration. For details on chart types and configuration, see Creating Metrics & Best Practices.

See also