Skip to main content
LayersQL provides seven datasets for building metrics. Each dataset exposes its own metrics, dimensions, and example queries.

Personalization dimensions (all datasets)

Every dataset exposes a shared set of session and customer dimensions you can use with GROUP BY, SEGMENT BY, and WHERE to segment metrics by shopper context:
  • shopping_channelweb or app.
  • 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: new or returning.
  • customer_state — Whether the shopper is authenticated: signed_in or guest.
  • customer_returning — Customer type: new or returning, based on prior order count.
  • b2b_company — Shopify B2B company location identifier for the signed-in company account.
Layers reads these values from the request 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 the orders table doesn’t store them directly.

Dates (all datasets)

All datasets accept the same date expressions in the SINCE 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-15 or 2025-03-15T10:30:00Z

Next steps