Personalization dimensions (all datasets)
Every dataset exposes a shared set of session and customer dimensions you can use withGROUP BY, SEGMENT BY, and WHERE to segment metrics by shopper context:
- shopping_channel —
weborapp. - locale — Storefront locale code (e.g.,
en,fr,pt-br). - currency — ISO 4217 currency code applied to the request (e.g.,
USD,EUR). - session_returning — Session type:
neworreturning. - customer_state — Whether the shopper is authenticated:
signed_inorguest. - customer_returning — Customer type:
neworreturning, based on prior order count. - b2b_company — Shopify B2B company location identifier for the signed-in company account.
context payload. For currency and b2b_company, the server-resolved value takes precedence over any client-supplied value.
When you use locale, currency, session_returning, customer_returning, or b2b_company with the Sales dataset, Layers joins them from the most recent session context. This lets you slice purchase metrics by these dimensions even though order data doesn’t store them directly.
Custom context dimensions
You can query the custom context parameters your storefront sends alongside the built-in dimensions. Once a parameter is discovered from live traffic, reference it in LayersQL ascustom.<key>, mirroring the path under context.custom with the context. prefix dropped.
- Where you can use them:
WHERE,GROUP BY, andSEGMENT BY. - Where you can’t: bare
SHOW. Custom dimensions aren’t metrics, soSHOW custom.storefrontis rejected at validation. - Discovery: the parameter must already appear in the store’s contextual field inventory. Query the
store-dimensionsMCP tool or open the field picker in any contextual conditions form to see what’s available. See Custom context fields for discovery timing and requirements. - Namespaced keys: parameters sent one level deep (for example,
context.custom.rivo.vipTier) use the same dotted path, so reference them ascustom.rivo.vipTier.
Dataset compatibility
Custom context values are recorded on request and event traffic, so they resolve for metrics sourced from those tables. Every dataset supports custom context dimensions except Sales, whose metrics come from order data and carry no storefront context. On the Products dataset, purchase-sourced metrics such astotal_sales, quantity_purchased, and purchase_sessions (and the ratios built on them) read from order data. LayersQL rejects any pairing of these metrics with a custom.* dimension at validation. For sales, use revenue instead: it measures the same purchases through the request tables and can be split by request context. The validation message for total_sales names both metrics so you can swap directly. The other purchase-sourced Products metrics have no request-backed equivalent.
On Collections, Blocks, and the Search datasets, purchase-sourced metrics resolve custom context through the originating request, so LayersQL accepts them.
revenue, use a dimension the Sales dataset exposes directly.
Dates (all datasets)
All datasets accept the same date expressions in theSINCE clause:
- Relative offsets:
-24h,-48h,-7d,-14d,-30d,-90d,-12m,-1y - Keywords:
today,yesterday,this_week,last_week,this_month,last_month,this_quarter,last_quarter,this_year,last_year - Rolling windows:
past_7_days,past_14_days,past_30_days,past_60_days,past_90_days,past_180_days,past_365_days - ISO timestamps:
2025-03-15or2025-03-15T10:30:00Z