Skip to main content

User Identification

Associate telemetry with specific users to enable per-user analysis in the Pulse dashboard.

Set a User ID

Call setUserId after the user authenticates:

import { Pulse } from '@dreamhorizonorg/pulse-react-native';

Pulse.setUserId('user-abc123');

To clear on logout, pass null:

Pulse.setUserId(null);

Set User Properties

Attach additional context — plan, region, account type:

// Single property
Pulse.setUserProperty('subscription', 'premium');

// Multiple at once
Pulse.setUserProperties({
subscription: 'premium',
region: 'us-west',
verified: true,
});

To clear a property, pass null:

Pulse.setUserProperty('subscription', null);

Common Pattern: Login / Logout

async function handleLogin(credentials) {
const user = await loginUser(credentials);

Pulse.setUserId(user.id);
Pulse.setUserProperties({
subscription: user.plan,
region: user.region,
});
}

function handleLogout() {
Pulse.setUserId(null);
}
note

User ID and properties are scoped to the current session. They persist until you explicitly clear them or the app process ends.

Native side

Use the native APIs when login or profile updates happen outside your JS bundle—for example native auth flows (Keychain, ASWebAuthenticationSession, Account Manager), a splash or onboarding layer implemented in Kotlin/Swift, or shared modules that resolve the user before React mounts.

import com.pulsereactnativeotel.Pulse

Pulse.setUserId("usr_12345")
Pulse.setUserProperty("plan", "premium")
// Pulse.setUserId(null) on logout

More (setUserProperties, attribute types): Android APIs · iOS APIs.

Next Steps