Skip to content

React Native SDK Integration

Add the heal-mam.js monitoring script to a React Native app.

1 min read Updated SS

Prepare and Integrate the Monitoring Script#

  1. Rename heal-mam.js.txt to heal-mam.js
  2. Copy heal-mam.js into your mobile app project directory

Step 2: Import Dependencies#

In your mobile app's entry file, add the following imports:

import Heal from './heal-mam.js'; // Approved versioned artifact supplied for your HEAL release
import { Platform } from 'react-native';  // Optional, for capturing mobile platform details

Step 3: Initialize the HEAL SDK#

Add the initialization code, replacing placeholder values with your actual data:

const customVariables = {
  // Allowlist only approved, non-sensitive operational attributes
};

Heal.init({
  urlEndpoint: 'https://heal-otel-collector-endpoint/v1/traces',  // Replace with your actual endpoint
  traceIdKey: '<trace-id-header-key>',   // Optional, default is 'traceparent'
  serviceName: '<service-name>',          // Unique identifier for your service
  ignoreUrls: ['/ignore-this-url'],       // Optional, URLs to exclude from tracing
  platform: Platform.OS,                  // Captures mobile platform details
  customVariables: customVariables        // Never include secrets or direct personal identifiers
});

Configuration Parameters#

Parameter Required Description
urlEndpoint Yes HEAL OTEL Collector endpoint URL (IP and port where the EUM server is running)
traceIdKey No Key used in HTTP headers to propagate trace information (default: traceparent)
serviceName Yes Unique identifier for your service
ignoreUrls No URLs to exclude from tracing
platform No Mobile platform details (Platform.OS)
customVariables No Approved non-sensitive operational attributes. Do not include usernames or other direct identifiers

Step 4: Configure Trace Propagation#

Ensure all requests sent from the mobile app include the necessary headers for trace propagation. The SDK automatically adds the traceparent header to outgoing requests.