Skip to main content

Navigation Instrumentation

Generates: Spans

Tracks screen navigation and route changes when using React Navigation.

Setup

Navigation instrumentation requires React Navigation v5.x or higher. The SDK currently supports:

Register the navigation container to start tracking:

import { NavigationContainer } from '@react-navigation/native';
import { Pulse } from '@horizoneng/pulse-react-native';

const navigationIntegration = Pulse.createNavigationIntegration();

function App() {

return (
<NavigationContainer
onReady={(ref) => navigationIntegration.registerNavigationContainer(ref)}
>
{/* Your screens */}
</NavigationContainer>
);
}

Configuration

Navigation instrumentation is enabled by default. You can disable it if needed:

Pulse.start({
autoDetectNavigation: true // Enabled by default
});

When autoDetectNavigation: false, navigation spans are not automatically tracked. No spans are created for screen transitions.

Generated Telemetry

Type: Span
Span Name: Navigated
Span Kind: INTERNAL

Attributes

AttributeDescriptionExampleAlways Present
pulse.typeInstrumentation type"screen_load"✅ Yes
screen.nameCurrent screen name"DetailsHome", "DetailsInfo"✅ Yes
last.screen.namePrevious screen name"DetailsInfo", "DetailsHome"⚠️ Only if previous screen exists
routeHasBeenSeenWhether route was visited beforetrue, false✅ Yes
routeKeyUnique route identifier"DetailsHome-Oht5epi34smXv9IlxNggQ"✅ Yes
phaseNavigation phase"start"✅ Yes
platformReact Native platform"react-native"✅ Yes

Note: The screen.name attribute in navigation spans refers to the React Native screen name, while screen.name in global attributes refers to the native Android activity.

Sample Payload: First Visit to Screen

{
"name": "Navigated",
"kind": "INTERNAL",
"startTimeUnixNano": "1732737006000000000",
"endTimeUnixNano": "1732737006014440000",
"duration": "14.44ms",
"attributes": {
"pulse.type": "screen_load",
"screen.name": "DetailsInfo",
"last.screen.name": "DetailsHome",
"routeHasBeenSeen": false,
"routeKey": "DetailsInfo-z46JYmBeWWnsPCJU4H7A8",
"phase": "start",
"platform": "react-native",
"session.id": "dce09977c69b0a5c15aa5fd01f817514"
}
}

Sample Payload: Returning to Screen

{
"name": "Navigated",
"kind": "INTERNAL",
"startTimeUnixNano": "1732737007000000000",
"endTimeUnixNano": "1732737007007270000",
"duration": "7.27ms",
"attributes": {
"pulse.type": "screen_load",
"screen.name": "DetailsHome",
"last.screen.name": "DetailsInfo",
"routeHasBeenSeen": true,
"routeKey": "DetailsHome-Oht5epi34smXv9IlxNggQ",
"phase": "start",
"platform": "react-native",
"session.id": "dce09977c69b0a5c15aa5fd01f817514"
}
}

Note: All navigation spans include global attributes (service, device, OS, session, network carrier, etc.). See Global Attributes for complete list.