Skip to main content

CodePush Tracking

Learn how to track over-the-air (OTA) update deployments in your React Native application.

Overview

If your app uses OTA updates like Delivr DOTA, you can track which JavaScript bundle version is running by setting a global attribute.

Why Track Code Bundle IDs?

With OTA updates, the same native app version (e.g., 1.0.0 build 123) can run multiple different JavaScript bundles. Tracking the code bundle ID helps you:

  • Identify deployment-specific issues - Pinpoint which OTA release caused an error or performance regression
  • Track update adoption - See how many users are on each bundle version and monitor rollout progress
  • Debug effectively - Match errors to the exact code version and source maps for accurate debugging
  • Rollback decisions - Quickly identify problematic deployments and make informed rollback decisions

Setup

Use the CodePush API to get the update metadata and set it as a global attribute:

import codePush from '@d11/dota';
import { Pulse } from '@horizoneng/pulse-react-native';

async function setupCodePushTracking() {
const update = await codePush.getUpdateMetadata();

if (update?.label) {
Pulse.setGlobalAttribute('codeBundleId', update.label);
} else {
// No OTA update - using embedded bundle
Pulse.setGlobalAttribute('codeBundleId', 'embedded');
}
}

setupCodePushTracking();

Viewing Data

Once configured, the codeBundleId attribute will appear in all telemetry:

{
"attributes": {
"codeBundleId": "v1.2.3-20240115.1",
"environment": "production",
"session.id": "abc123...",
...
}
}

You can then filter telemetry by code bundle ID to analyze specific deployments, compare error rates across versions, and track adoption rates.