The drs module allows you to integrate Fraud Prevention services into your application.
When the SDK is initialized, it automatically starts to collect and submit telemetry data to Mosaic—including information of the user journey using various JS events, browser data, and user interactions. Once specific user actions are performed on the client side (such as login), this SDK module should be called in order to track those action events. The data collected by the SDK can then be queried for recommendations using Recommendations backend API.
Load the SDK:
npm install @transmitsecurity/platform-web-sdk@^2To initialize, use the following code:
// Import Fraud Prevention module
import { drs, initialize } from '@transmitsecurity/platform-web-sdk';
// Initialize SDK
// If SDK was loaded via script tag, use window.tsPlatform.initialize({ ... })
initialize({
clientId: 'your-client-id',
drs: {
serverPath: 'https://api.transmitsecurity.io/risk-collect/', // Required: Set serverPath based on your region or custom domain
enableSessionToken: true
}
});Customizations:
| Name | Type | Description |
|---|---|---|
enabled | boolean | Fraud Prevention is enabled when initialized. Set to false to explicitly disable the module. |
serverPath | string | (Required) The Fraud Prevention module should be configured to work with your region or custom domain by setting serverPath to:- https://api.transmitsecurity.io/risk-collect/ (for US) - https://api.eu.transmitsecurity.io/risk-collect/ (for EU) - https://api.ca.transmitsecurity.io/risk-collect/ (for Canada) - https://api.au.transmitsecurity.io/risk-collect/ (for Australia) - https://api.sbx.transmitsecurity.io/risk-collect/ (for sandbox) - https://<your_custom_domain>/risk-collect/ (for custom domain) For the SDK modules to work properly together, the regions must match. |
enableSessionToken | boolean | When set to true, generates a session token required for reporting action events from the backend. See getSessionToken(). |