---
title: Statistics
date: 2026-06-13T16:16:00+01:00
author: John Henry Donovan
canonical_url: "https://johnhenry.ie/plugins/order-lifecycle/docs/guide/statistics"
section: Plugins
---
esc

↑↓ to navigate↵ to selectesc to close

Menu On this page 

- [Return to top](#)

Documentation

Documentation

# Statistics

## Per-Order Summary Cards

Four summary cards sit at the top of the Order Lifecycle field on every order edit page, with a Started/Completed bar underneath:

- **Time to Convert** - from the first cart activity to order completion
- **Checkout Duration** - from checkout started to the order being paid
- **Cart Items** - line items added and removed
- **Customer** - new or returning, with a link to their previous order count

Any card that hasn't happened yet is simply left out rather than shown as empty. See [Timeline View](https://johnhenry.ie/plugins/order-lifecycle/docs/guide/timeline-view) for the full breakdown, including what the Started/Completed bar shows.

### Duration Formats

RangeFormatExampleUnder 1 minuteSeconds`45s`1 minute - 1 hourMinutes and seconds`5m 30s`1 hour - 24 hoursHours and minutes`2h 15m`Over 24 hoursHours and minutes`26h 45m`

## Store Dashboard

The dedicated **Order Lifecycle** section in the Craft control panel is where you go for store-wide metrics. Navigate to **Order Lifecycle → Overview** in the sidebar.

### Time Window

Switch periods using the button group in the top-right corner of the page. Available windows are **7, 14, 30, 60, 90 days**, or **All time** (no date filter).

The **All time** view includes every log since the plugin was installed. Trend indicators aren't shown for the all-time view, since there's no equivalent prior period to compare against.

### Metrics

- Total lifecycle log entries
- Unique orders tracked
- Average logs per order
- Top 5 event types by frequency
- Average time to order completion
- Conversion rate (carts created → orders completed)
- **Avg. Checkout Time** - time from the `checkoutStarted` event to payment. Shows blank when no checkout-start event was recorded for the orders in the window (e.g. admin- or API-created orders that skip checkout tracking)
- Cart abandonment rate
- **Avg. Payment Retries** - the average number of retries *among orders that actually needed them*. A value of `0` means the order paid on the first try - and, as noted under [Event Categories and Icons](https://johnhenry.ie/plugins/order-lifecycle/docs/guide/timeline-view), that first successful attempt doesn't show up in the timeline
- **Returning Customers %** - the share of customers who had a prior completed order, matched by email address
- Average cart value
- Email success rate

#### Rounding

All rate and percentage metrics are rounded to **1 decimal place** (e.g. `53.5%`, `1.1` retries).

#### Layout and Colour

The stat grid is grouped by what each metric measures, in a fixed order: volume (Total Events, Events/Order), conversion (Conversion, Abandonment), timing (Avg. Checkout, Avg. Complete), then payment retries, returning customers, and the two optional metrics (Avg. Cart Value, Email Success) if there's data for them. Colour is used sparingly: **Conversion** turns green at 50% or higher, **Abandonment** turns amber at 30% and red at 50% - everything else stays neutral so those exceptions stand out.

![](https://johnhenry.ie/images/plugins/docs/order-lifecycle/dashboard-overview.png)### Trend Chips

Each metric card that supports trending shows a small coloured **trend chip** (a ↑ / ↓ badge) next to the stat number, comparing the selected period to the equivalent prior period:

BadgeMeaning↑ 12%Metric increased by 12% relative to the prior period↓ 5%Metric decreased by 5% relative to the prior period→ &lt;1%Change is negligible (under 1%)

Colour follows whatever direction benefits the store - green for improvements (e.g. conversion up, abandonment down), red for anything getting worse. If the prior period had no data the badge is left off.

Trends are worked out for total events, unique orders, conversion rate, abandonment rate, and email success rate. The period note at the bottom of the page tells you which window is being compared.

Trends are cached alongside the rest of the stats (5-minute TTL), so switching periods updates the comparison right away.

### Alert Banners

If any key metric crosses a concerning threshold, an amber or red banner shows up above the stat grid. Alerts fire when:

ConditionThresholdNotesNo orders tracked0 unique ordersOnly fires for period-based views, not all timeHigh abandonment&gt; 75%Requires at least 5 carts in the periodEmail failuresSuccess rate &lt; 90%Requires at least 5 emails sent or failedPayment frictionAvg attempts &gt; 2Requires at least 5 completed orders

Alerts are informational only - nothing happens automatically off the back of them.

## Dashboard Widget

The **Order Lifecycle Stats** dashboard widget is also there if you'd rather have stats on the main Craft dashboard alongside your other widgets. Add it via **Dashboard → Add a widget**. It shows the same metrics as the Overview page for a configurable time window.

The widget's own title bar shows the order count in scope (e.g. "Last 11 orders") instead of repeating it in the Total Events card underneath.

The widget's settings (gear icon on the widget) also have a **Show Top Events** switch, so stores that just want the stat grid can turn the Top Events list off.

## Accessing Data Programmatically

Use the logger service to pull log arrays for your own custom reporting:

```php
use johnhenry\orderlifecycle\OrderLifecycle;

$logs = OrderLifecycle::getInstance()->getLogger()->getLogsForOrder($order->id);

// Find key timestamps
$cartCreatedAt = null;
$orderCompletedAt = null;

foreach ($logs as $log) {
    if ($log['type'] === 'cartCreated' && $cartCreatedAt === null) {
        $cartCreatedAt = strtotime($log['dateCreated']);
    }
    if ($log['type'] === 'orderCompleted' && $orderCompletedAt === null) {
        $orderCompletedAt = strtotime($log['dateCreated']);
    }
}

if ($cartCreatedAt && $orderCompletedAt) {
    $minutes = ($orderCompletedAt - $cartCreatedAt) / 60;
    echo "Checkout took {$minutes} minutes";
}
```

`getLogsForOrder()` returns database rows as plain arrays. The `dateCreated` field is a datetime string, so use `strtotime()` to convert it before doing arithmetic on it.

## Use Cases

### Spotting Checkout Bottlenecks

A long **Time to Convert** may indicate:

- A complex or confusing checkout flow
- Cart abandonment and return
- Customers comparison-shopping

### Monitoring Payment Performance

A long **Checkout Duration** may indicate:

- Payment gateway latency
- 3D Secure authentication delays
- Failed attempts before a successful payment

### Identifying Abandoned Carts

When a cart has a **Started** timestamp but no **Completed** one, it's either still active or has been abandoned. The dashboard's abandonment rate tracks this store-wide.

## Caveats

### Active carts are included in stats

All dashboard metrics include carts that are still in progress at the time of calculation. This is noted at the bottom of the Overview page ("includes carts currently in progress").

This mainly affects **Conversion Rate** and **Abandonment Rate**. A cart created two hours ago that hasn't completed yet counts as "abandoned" in those calculations. Over longer windows (30–90 days) the skew is negligible. For a 7-day window it's more noticeable.

If you need precise conversion figures for a closed time window, use the [Export](https://johnhenry.ie/plugins/order-lifecycle/docs/guide/export) feature to pull raw events into a spreadsheet or BI tool.

### Deleted orders

When Craft purges or deletes an order (including Commerce's inactive cart purge), its lifecycle logs are automatically removed so they don't skew the stats. This happens through Craft's element deletion event and is also covered by Craft's garbage collection cycle.

If you've got orphaned logs from orders deleted before this cleanup was in place, remove them with:

```php
php craft order-lifecycle/logs/purge-orphaned
```

## Limitations

- **Legacy orders**: Events are only recorded from when the plugin is installed onward. Orders created before that will have no lifecycle data.
- **Manual orders**: Admin-created orders may skip the `cartCreated` event.
- **API orders**: Orders created via API may not trigger all Commerce events, depending on the integration.

## Related Documentation

- [Timeline View](https://johnhenry.ie/plugins/order-lifecycle/docs/guide/timeline-view) - Per-order event timeline
- [Event Tracking](https://johnhenry.ie/plugins/order-lifecycle/docs/guide/event-tracking) - What events are logged
- [Configuration](https://johnhenry.ie/plugins/order-lifecycle/docs/getting-started/configuration) - Enabling/disabling event categories
- [Export](https://johnhenry.ie/plugins/order-lifecycle/docs/guide/export) - Exporting lifecycle events to CSV
- [Services API](https://johnhenry.ie/plugins/order-lifecycle/docs/api/services) - Programmatic access to log data

On this page
