Testing and QA

Verify your Zeta React Native SDK integration before shipping to production.

Testing your React Native integration involves verifying both the JavaScript layer and the underlying native iOS and Android modules. This guide will walk you through setting up your environment, verifying initialization, testing push and in-app payloads, and debugging the native bridge.

On this page


Environment setup

Because the React Native SDK wraps native platform modules, testing requires physical devices or specific emulator configurations:

  • iOS Testing: You must use a physical iOS device. Push notifications and certain native background behaviors do not work on the iOS Simulator.
  • Android Testing: You can use a physical Android device or an Android Virtual Device (AVD) emulator. Ensure the emulator has Google Play Services (GMS) installed.
  • Debugging Tools: Use React Native Debugger or Chrome DevTools for JavaScript debugging, and Xcode Console (iOS) or Android Logcat (Android) for native-layer logs.

Verifying SDK initialization

After calling ZetaClient.initialize() in your root component, verify that both the JavaScript and native layers have initialized successfully.

Check the JavaScript layer

Verify that the initialization callback executes without errors. You can log a success message or inspect the client state:

ZetaClient.initialize(config, () => {
  console.log('Zeta SDK is ready');
});

Check the native layer

Open your native logging console to verify that the native SDKs started successfully:

  • iOS: Open Console.app, select your physical device, and filter by your app's Bundle ID. Look for initialization logs from the ZetaCore framework.
  • Android: Run adb logcat -s ZetaCore in your terminal and look for successful initialization entries.

Verify BSIN assignment

The Browser Session Identifier (BSIN) is assigned by ZMP within a few seconds of a successful initialization.

To retrieve the cached BSIN, set up an event listener for the IdentityDelegate and trigger the fetch:

import { Platform, NativeEventEmitter, DeviceEventEmitter } from 'react-native';
import ZetaClient, { ZetaCoreEvents } from 'zetakit_reactnative';

// Set up the correct event emitter for the platform
const eventEmitter = Platform.select({
  ios: new NativeEventEmitter(ZetaClient.bridge),
  android: DeviceEventEmitter,
});

// Register the listener
const identityListener = eventEmitter?.addListener(
  ZetaCoreEvents.IdentityDelegate,
  (event) => {
    console.log('Successfully retrieved BSIN:', event.bsin);
  }
);

// Trigger the fetch
ZetaClient.getCachedBSIN();

Testing push notifications

Push notification testing requires verifying three layers: native push registration, the JavaScript bridge, and ZMP delivery.

Verify native push setup

Verify that your native push credentials and certificates are configured correctly:

Verify the JavaScript bridge

Set up a deep link event listener in your React Native code and verify it fires when you tap a notification containing a deep link:

const deeplinkListener = eventEmitter?.addListener(
  ZetaCoreEvents.DeeplinkDelegate,
  (event) => {
    console.log('Deeplink clicked:', event.deeplink);
    console.log('Campaign metadata:', event.extraInfo);
  }
);

Send a test push from ZMP

  1. Copy your device's BSIN (retrieved in the initialization step).
  2. In the ZMP console, navigate to Settings > Integrations > Keys.
  3. Enter your BSIN in the Test Integration field and click Test Integration.
  4. Verify that the notification appears on your device and tapping it triggers your JavaScript event listener.
ZMP Settings → Integrations → Keys → Test Integration screen with the BSIN field filled in and the Test Integration button highlighted

The ZMP Test Integration screen, where you paste a device BSIN to send a targeted test push.


Testing in-app messages

In-app messages are displayed automatically in the foreground when triggered by user behaviors.

  • In-App Messaging is on by default: The SDK displays foreground messages automatically after initialization. If your app called ZetaClient.inapp.stop(), call ZetaClient.inapp.start() to resume displays before testing.

  • Create a Test Campaign: In the ZMP console, create an in-app campaign targeting a segment that includes your test device's user profile.

  • Trigger the Message: Open your app on the test device. The message should display as a foreground toaster or modal.

  • Listen for Lifecycle Events: Register an InAppMessageDelegate listener to verify that display, click, and dismiss events are bridged to JavaScript:

    const inAppListener = eventEmitter?.addListener(
      ZetaCoreEvents.InAppMessageDelegate,
      (event) => {
        console.log('In-app event occurred:', event);
      }
    );

Bridge-layer debugging

If events are firing on the native side but do not reach your JavaScript code:

  • Verify Linking: Ensure the native module is correctly linked. Run npx react-native config and verify that zetakit_reactnative is listed under dependencies.
  • Check Metro Bundler: Inspect your Metro bundler terminal output for any compilation warnings or bridge-loading errors.
  • Register Listeners Early: Ensure your event listeners are registered before the events occur. If a listener is registered after an event fires (e.g., after a deep link opens the app), the event will be missed.

The QA debug checklist

Use this checklist to verify that your integration is fully production-ready:

  • JavaScript Initialization: Verify that calling ZetaClient.initialize() completes without throwing errors.
  • Native Initialization: Check native logs (Console.app or Logcat) to confirm that the native core engines started successfully.
  • BSIN Retrieval: Confirm that calling ZetaClient.getCachedBSIN() triggers your IdentityDelegate listener and returns a valid BSIN.
  • Custom Event Tracking: Send a custom event using ZetaClient.events.send(), then check the ZMP console to verify the event and its properties are received.
  • Device Token Registration: Check native logs to confirm that the native device push token was successfully captured and forwarded.
  • Push Notification Receipt: Send a test push from ZMP and verify the notification banner appears on the physical device.
  • Deeplink Click Tracking: Tap a push notification containing a deep link and verify that your DeeplinkDelegate listener receives the link and campaign metadata.
  • In-App Message Display: Trigger an in-app campaign and confirm the message renders correctly in the foreground.
  • Opt-Out Compliance: Call ZetaClient.optOutFromTracking(), then verify that no further events are sent to ZMP and the local database is cleared.

Common issues

Module not found error for zetakit_reactnative

  • iOS: Run cd ios && pod install to ensure the CocoaPods dependencies are installed and linked.
  • Android: Ensure the package is included in your android/settings.gradle file.
  • General: Run npx react-native config to verify that the CLI detects the React Native module.

Push notifications work on iOS but not Android (or vice versa)

  • The native push configurations are completely independent. Review the platform-specific native push guides to verify certificates (APNs) and services (FCM) are configured correctly.

Events fire on native but not in JavaScript

  • The JavaScript bridge may not be fully initialized when the event occurs. Ensure you call ZetaClient.initialize() as early as possible in your application lifecycle and register your event listeners immediately afterward.

See also