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 segmentation by dimensions (country, marketing channel, etc.)
- Real-time computation from search, browse, and interaction events
- Ideal for metrics like views, add-to-carts, and search-driven conversions
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
- 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
, orweekly
What you can do with metrics
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
View real-time metrics while creating or editing merchandising rules to make informed decisions about product placement, pins, and boosts. Metrics provide the quantitative foundation for manual merchandising decisions. Examples:- 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
Common Metric Use Cases
Behavioral Metrics (LayersQL)
- View Sessions: Unique sessions where products were viewed
- Cart Sessions: Unique sessions where products were added to cart
- Purchases: Total purchases tracked through Layers
- Conversion Rate: Percentage of viewers who purchased
- Click-Through Rate: Percentage of impressions that resulted in clicks
Financial Metrics (Imported/ShopifyQL)
- Net Sales/Revenue: Sales minus returns from Shopify data
- Return Rate: Percentage of items returned
- Average Order Value: Average price per transaction
- Sales Velocity: Units sold per time period
- Gross Margin: Profit margins from Shopify financial data
Common Metric Recipes
The platform provides pre-configured metric recipes that implement common use cases for both LayersQL and Imported metrics.LayersQL Metric Recipes
Total Sales (7 days)Imported (ShopifyQL) Metric Recipes
Return Rate (7 days) - Refresh: DailyThese recipes are available in your Layers dashboard. Navigate to the Metrics section and select from the recipe library to install and customize them for your specific requirements.
Creating Custom Metrics
Creating a LayersQL Metric
- Navigate to Metrics in your Layers dashboard
- Click “Create Metric”
- Select “LayersQL” as the metric type
- Write your LayersQL query following the syntax:
FROM → SHOW → GROUP BY → SINCE
- Optionally add
WHERE
clauses for filtering orSEGMENT BY
for dimensional breakdowns - Name your metric and save
Creating an Imported Metric
- Navigate to Metrics in your Layers dashboard
- Click “Create Metric”
- Select “Imported (ShopifyQL)” as the metric type
- Write your ShopifyQL query ensuring it includes
product_id
- Set the refresh frequency (hourly, daily, or weekly)
- Name your metric and save
Metric Refresh and Updates
LayersQL metrics update in real-time as behavioral data flows through the Layers analytics pipeline. There is no manual refresh required. Imported metrics refresh automatically based on their configured schedule:- Hourly: Updated every hour for time-sensitive metrics
- Daily: Updated once per day, ideal for most sales metrics
- Weekly: Updated weekly for slower-moving or historical metrics
Best Practices
Choosing Between Metric Types
Use LayersQL metrics when:- You need real-time behavioral data from search and browse interactions
- Segmentation by marketing channel or geography is important
- The metric is based on user engagement (views, clicks, searches)
- You need Shopify’s authoritative sales and financial data
- Return rates, refunds, or detailed order information is required
- Daily or periodic updates are sufficient
Query Optimization
- Keep time windows reasonable (7-30 days) to balance freshness with data volume
- Use
WHERE
clauses to pre-filter data before aggregation - For Imported metrics, avoid queries that return excessive rows
- Test queries on a subset of data before deploying to production
Naming Conventions
- Include the time window in the metric name (e.g., “Sales 7d”, “Returns 30d”)
- Use clear, descriptive names that indicate the metric’s purpose
- Distinguish between LayersQL and Imported metrics in naming when helpful
Where metrics show up
- Sort Orders: Add metric-based conditions and weights to control product ranking
- Merchandising Rules: Preview live metrics as you pin, boost, or group products
- Analytics Dashboard: Track metric trends over time for performance monitoring
- Product Details: View individual product metric values for manual merchandising