Skip to main content

Statistics Queries

Aggregate statistics for your store’s business metrics.

Order Statistics

query($storeId: String!) {
  orderStatistics(storeId: $storeId) {
    totalOrders
    totalRevenue
  }
}

Payment Statistics

query($storeId: String!) {
  paymentStatistics(storeId: $storeId) {
    totalPayments
    successRate
  }
}

Product Statistics

query($storeId: String!) {
  productStatistics(storeId: $storeId) {
    totalProducts
    activeProducts
  }
}

Combined Dashboard Query

Fetch all core metrics in a single request:
query($storeId: String!) {
  orderStatistics(storeId: $storeId) {
    totalOrders
    totalRevenue
  }
  paymentStatistics(storeId: $storeId) {
    totalPayments
    successRate
  }
  productStatistics(storeId: $storeId) {
    totalProducts
    activeProducts
  }
}
Variables:
{ "storeId": "STO_3bVzrkD0FJjFdZNLk8Ualx" }

SDK Example

const result = await client.graphql.query<{
  orderStatistics: { totalOrders: number; totalRevenue: number };
  paymentStatistics: { totalPayments: number; successRate: number };
  productStatistics: { totalProducts: number; activeProducts: number };
}>({
  query: `query($storeId: String!) {
    orderStatistics(storeId: $storeId) { totalOrders totalRevenue }
    paymentStatistics(storeId: $storeId) { totalPayments successRate }
    productStatistics(storeId: $storeId) { totalProducts activeProducts }
  }`,
  variables: { storeId: "STO_3bVzrkD0FJjFdZNLk8Ualx" },
});

Trend Analysis

Track metrics over time periods:
query($storeId: String!) {
  trendAnalysis(storeId: $storeId) {
    period
    orders
    revenue
    payments
  }
}

Distribution Analysis

Analyze revenue distribution by currency, country, or product:
query($storeId: String!) {
  distributionAnalysis(storeId: $storeId) {
    dimension
    value
    count
    amount
  }
}

Customer Analysis

Understand your customer base:
query($storeId: String!) {
  customerAnalysis(storeId: $storeId) {
    totalCustomers
    newCustomers
    returningCustomers
  }
}

Subscription Analysis

Track subscription health metrics:
query($storeId: String!) {
  subscriptionAnalysis(storeId: $storeId) {
    activeSubscriptions
    churnRate
    mrr
  }
}

Tax Analysis

Review tax collection by region:
query($storeId: String!) {
  taxAnalysis(storeId: $storeId) {
    country
    taxAmount
    orderCount
  }
}

Refund Ticket Analysis

Track refund patterns:
query($storeId: String!) {
  refundTicketAnalysis(storeId: $storeId) {
    totalTickets
    approvedCount
    rejectedCount
    totalRefundedAmount
  }
}