> ## Documentation Index
> Fetch the complete documentation index at: https://patch.codemagic.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Analytics and metrics

> Monitor download, ready, applied, and rollback metrics; source maps for Datadog and other crash tools.

Patch records download, ready, applied, and failure events from the client SDK. Use the dashboard and CLI to monitor rollout health.

The client posts events to `{apiUrl}/v1/metrics/events`. Metrics failures never block the update flow; the SDK queues and retries natively.

## Dashboard

The web dashboard is your team's control plane in the browser: apps, deployments, release history, New release (command builder, or `.cmpatch` upload for React Native), promote/rollback/rollout actions, members, and API tokens.

Open a deployment for adoption over time and in-range totals, then a release for its counters and failure drill-down. See [Web dashboard](/docs/using-patch/dashboard) for a full walkthrough. Open it at your API URL after [install](/docs/install) (e.g. `https://updates.example.com/`).

## CLI metrics

### Deployment-level metrics

  <TabItem value="react-native" label="React Native">

```bash
cmpatch deployment metrics --app MyApp-iOS --deployment Production --format table
```

  </TabItem>
  <TabItem value="capacitor" label="Capacitor">

```bash
cmpatch-capacitor deployment metrics --app MyApp-iOS --deployment Production
```

  </TabItem>
</SdkTabs>

Useful for overall adoption and health across all releases in a deployment.

### Per-release metrics

  <TabItem value="react-native" label="React Native">

```bash
cmpatch release metrics --app MyApp-iOS --deployment Production --label v4 --format table
```

  </TabItem>
  <TabItem value="capacitor" label="Capacitor">

```bash
cmpatch-capacitor release metrics --app MyApp-iOS --deployment Production --label v4
```

  </TabItem>
</SdkTabs>

### Daily time series

`cmpatch deployment timeseries` prints the counters behind the dashboard's deployment chart, one row per UTC day:

```bash
cmpatch deployment timeseries --app MyApp --deployment Production --range 30d
```

`--range` takes `7d`, `30d`, `90d`, or `1y`; `--from` / `--to` set an explicit range instead. `ACTIVE` here is the devices active on that day, not the lifetime count of `deployment metrics`. `--format json` also carries one series per release. For a Capacitor app, run `cmpatch-capacitor deployment timeseries` with the same flags.

### Failure drill-down

The `failure_reasons` in `deployment metrics --format json` (or `release metrics --format json`) count failed events by reason. Drill into one reason the way the dashboard's failure dialog does: its codes, then one code's top exit reasons and messages, then the single events.

```bash
cmpatch deployment failures --app MyApp --deployment Production --reason network
cmpatch deployment failures --app MyApp --deployment Production --reason network --code 403
cmpatch deployment failure-events --app MyApp --deployment Production --reason network --code 403
```

`--no-code` in place of `--code` opens the failures that reported no code (the `(no code)` row), not every code. `failure-events` prints a page of events, newest first; when more remain, the last line gives the `--cursor` to pass for the next page. `cmpatch release failures` and `cmpatch release failure-events` do the same for one release (`--label` or `--release-id`). `cmpatch-capacitor` has the same four commands, with the same flags, for Capacitor apps.

Typical event types include Downloaded, Ready, Applied, Failed, and Active.

## What to watch during a rollout

Ready and Applied

Ready means the downloaded artifact is unpacked and the SDK has prepared state
for the next session according to the activation policy. Applied means the new
update runs successfully and `notifyAppReady()` confirms it. A Ready update can
wait for a restart before it becomes Applied.

Application success rate is Applied / (Applied + Failed). Historical
Installed and Success events are included as Ready and Applied respectively;
stored events are not rewritten. Apps still on an SDK released before the rename
keep reporting Installed and Success, and the server counts them as Ready and
Applied. API counter keys remain `installed` and
`success` for compatibility, while dashboard and CLI labels use the new names.

Failures and rollbacks

Spikes after a release often mean a bad bundle or incompatible native project. Check [Debugging](/docs/troubleshooting) and consider [rollback](/docs/using-patch/production-control#roll-back-to-the-previous-release).

Failure counts, including their breakdown by message and exit reason, are kept indefinitely. The list of individual failure events covers the last 8 days.

Active count

How many devices are running a given release label, helps confirm a gradual rollout is progressing.

## Monitoring such as Datadog or Sentry

Tools like Datadog or Sentry need extra information to see which OTA release a device has installed. That usually means uploading a source map for each release.

OTA JS ships minified, so without a map your crash tool only shows a wall of names. Upload the map to a tool such as Datadog or Sentry. Keeping a copy on Patch alone does not symbolicate those stack traces.

  <TabItem value="react-native" label="React Native">

Have the bundler write a map when you publish (`--sourcemap-output`), then upload that file with your crash tool in the same CI job. Patch does not push maps to Sentry or Datadog for you. A copy attached to the release is stored privately under `_internal`; apps never download it for OTA.

```bash
cmpatch release-react \
  --deployment Staging \
  --platform ios \
  --sourcemap-output ./build/main.jsbundle.map \
  --yes

# Separate step: your crash tool's CLI, not cmpatch
npx @sentry/cli sourcemaps upload ./build/main.jsbundle.map
# Add whatever release, dist, and auth flags your Sentry setup uses.
```

For Datadog, use the same map path with `datadog-ci` instead of the Sentry CLI.

  </TabItem>
  <TabItem value="capacitor" label="Capacitor">

`cmpatch-capacitor` does not upload source maps. Upload them to your crash reporting tool from the CI job that builds `webDir`. Any `.map` files in `webDir` are included in the release and downloaded to devices; remove them before publishing if needed.

  </TabItem>
</SdkTabs>

Use a version tag that matches how you label that OTA release in RUM or errors.

## Example rollout monitoring workflow

```text
release with --rollout-percentage 10
→ watch deployment metrics for 24h
→ increase rollout or promote to Production
→ rollback if failure rate spikes
```

See [Production control](/docs/using-patch/production-control) for rollout commands.
