Test your JavaScript DRS integration

Before using your Detection and Response Services (DRS) in production, ensure its successful integration and correct functioning within a running environment. This guide walks you through the basic steps to test your JavaScript SDK integration.

Before testing

To test your integration, you'll need:

  1. Access to the Detection and Response pages in the Mosaic Admin Portal
  2. A running environment for the application you've integrated with Transmit
Tip

Add a Rule that always allows actions from the IP addresses (or ranges) you use for testing and automation purposes. This ensures that those IPs are never challenged or denied by Mosaic.

Step 1: Initialize DRS services

Check in your app that the DRS SDK is initialized and collecting telemetry data. This validates Step 2 of your quickstart integration.

  1. In your browser of choice open Developer tools > Network and filter Fetch/XHR requests.
  2. Navigate to a page in your application that initializes the SDK and click anywhere on the screen several times.
  3. Validate that the network activity includes multiple /device/events requests to Mosaic.

Step 2: Trigger action event

Check if action events on your app are reported to Mosaic. This validates Step 4 of your quickstart integration.

  1. Navigate to your application.
  2. Perform an action expected to trigger an action event. For example, enter a username and click the login button, if you implemented DRS logic on the login button.
  3. Validate that an event related to the triggered action is shown in the Admin Portal's recommendation log ( Detection and Response > Recommendations ). You can click the recommendation to inspect its details.

Step 3: Get recommendation

Check that the application can obtain a recommendation for a triggered action. This validates Step 5 of the quickstart integration.

  1. Within your application, perform an action that triggers an action event and intercept the returned ActionToken through client-side or server-side logs.
  2. Send a backend GET request to our /recommendation endpoint with the action token.
  3. Validate that the API returns a successful response that includes the recommendation.

Step 4: Set user

Check that recommendations are associated with a user identifier. This validates Step 3 of your quickstart integration.

  1. Authenticate a user in your application and report to Mosaic the user identifier.
  2. Perform an action that triggers an action event according to your implementation.
  3. Validate that the action event is reported in the Admin Portal's recommendation log ( Detection and Response > Recommendations ), and the recommendation details include the user identifier.