Puddle Developer Documentation
Analytics (PQL)

Examples

Common questions answered with PQL.

Each example shows the text form followed by the equivalent JSON. The same queries are returned by describe, so LLM callers see them too.

Sales

Revenue trend this month vs last month

orders: revenue, order_count, aov by time.day during this_month compare previous_period
{ "dataset": "orders", "measures": ["revenue", "order_count", "aov"], "dimensions": ["time.day"], "time": { "range": "this_month", "compare": "previous_period" } }

Revenue from new vs returning customers

orders: revenue, order_count, customers by customer_type during year_to_date

Orders by province, excluding cancellations

orders: order_count, revenue by province where status != CANCELLED during last_365_days

Best hour and day to sell

orders: order_count by time.day_of_week, time.hour_of_day during last_90_days sort order_count desc limit 10

Promotion code performance

orders: order_count, revenue, discounts by promotion_code where promotion_code is not null during last_90_days

Products

Top 10 products by units sold

products: units_sold, item_revenue by product, product_id during last_90_days sort units_sold desc limit 10

Variant breakdown for one product

products: units_sold by variant where product = "Linen Shirt" during last_365_days

Customers and carts

Sign-ups and marketing opt-ins per month

customers: new_customers, marketing_subscribers by time.month during this_year

Abandoned carts this week

carts: carts, abandoned_carts, cart_conversion_rate during this_week

Web traffic

Traffic sources

web: visitors, visits, bounce_rate by referrer during last_30_days limit 15

UTM campaigns

web: visitors, pageviews by utm_source, utm_campaign where utm_source is not null during last_month

Most viewed products

web: pageviews, visitors by product_slug where product_slug is not null during last_30_days sort pageviews desc limit 10

Visitors by region

web: visitors by region where country = ZA during last_30_days

Custom events

web: events, event_visitors by event_name where event_name is not null during last_30_days

Blended

Store conversion rate per week

blend: orders.order_count, web.visits, conversion_rate by time.week during last_90_days

Products that get views but don't sell

blend: web.pageviews, products.units_sold, view_to_purchase_rate by product_slug during last_30_days sort web.pageviews desc limit 20

Revenue per visitor, year on year

blend: revenue_per_visitor during last_30_days compare previous_year

On this page