CodePush Tracking
If your app uses OTA updates (e.g. CodePush), track which JavaScript bundle version is running by setting a global attribute. With OTA updates, the same native app version can run multiple different JS bundles — this lets you filter telemetry by deployment in the dashboard.
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 '@dreamhorizonorg/pulse-react-native';
async function setupCodePushTracking() {
const update = await codePush.getUpdateMetadata();
if (update?.label) {
Pulse.setGlobalAttribute('codeBundleId', update.label);
} else {
Pulse.setGlobalAttribute('codeBundleId', 'embedded');
}
}
setupCodePushTracking();
Once set, codeBundleId appears on all telemetry and can be used to filter sessions, errors, and traces by deployment.
Upload Source Maps per Bundle
Whenever you push a new OTA bundle, upload its source maps with the same --bundle-id so Pulse can symbolicate stack traces for that specific deployment:
# Android
yarn pulse-cli upload react-native-android \
--api-url=https://your-backend.com \
--api-key=your-api-key \
--app-version=1.0.0 \
--version-code=7 \
--js-sourcemap=./path/to/bundle.map \
--bundle-id=v4
# iOS
yarn pulse-cli upload react-native-ios \
--api-url=https://your-backend.com \
--api-key=your-api-key \
--bundle-version=1.0.0 \
--version-code=123 \
--js-sourcemap=./path/to/bundle.map \
--bundle-id=v4
The --bundle-id value must match the update.label you set as codeBundleId — otherwise Pulse cannot correlate the stack trace to the correct source map.