The Radar loader script accepts a configuration object that allows you to customize its behavior, enable features, and manage integrations. While only a few parameters are required for basic setup, a rich set of options is available for advanced use cases.

Basic Configuration

These are the essential parameters required to get Radar running.
profileId
string
required
The unique tracking script ID generated for each of your customers via the Operator API. This ensures data is routed to the correct account.
namespace
string
required
The name of the global JavaScript object your customers will use to interact with the tracker (e.g., YourAppName). This allows them to call functions like YourAppName.track("Custom Event"). We recommend using a single, consistent namespace across all customers.
cdn
string
Your custom CDN proxy domain (e.g., cdn.your-app.com). Defaults to cdn.snitcher.com if not provided.
apiEndpoint
string
Your custom API proxy domain (e.g., api.your-app.com). Defaults to radar.snitcher.com if not provided.

Feature Flags

The features object allows you to enable or disable specific automatic tracking capabilities.
!(function (e) {
  /* ...loader script... */
})({
  profileId: "ts_a1b2c3d4e5f6g7h8",
  namespace: "YourAppName",
  features: {
    sessionTracking: true,
    formTracking: true,
    clickTracking: true,
    downloadTracking: true,
  },
});
features.sessionTracking
boolean
default:"false"
When true, Radar will automatically track user sessions, including session start, end, and updates. This is required for session-based delivery.
features.pageTracking
boolean
default:"true"
When true, Radar automatically tracks pageviews and page leaves, including engagement time on each page.
features.formTracking
boolean
default:"false"
When true, enables automatic tracking of form interactions, including:
  • form_start: When a user first interacts with a form.
  • form_submit: When a form is submitted.
  • form_abandon: When a user interacts with a form but leaves the page before submitting.
Radar automatically redacts values from fields commonly associated with sensitive data (e.g., password, credit_card).
features.clickTracking
boolean
default:"false"
When true, automatically captures clicks on links, buttons, and elements with a data-track-event attribute.
features.downloadTracking
boolean
default:"false"
When true, automatically tracks clicks on links that point to files with common document extensions (e.g., .pdf, .docx, .zip).
features.errorCapture
boolean
default:"false"
When true, the tracker will report its own internal JavaScript errors to Snitcher for debugging purposes.
If set to true, Radar will not use persistent storage (cookies or localStorage) until the giveCookieConsent() method is called. This is essential for complying with privacy regulations like GDPR. See the Consent Management guide for more details.

Advanced Transport Configuration

The transport object lets you fine-tune how data is sent to Radar’s servers.
transport.batchSize
number
default:"10"
The number of events to queue before sending them to the API in a single batch.
transport.flushInterval
number
default:"3000"
The maximum time in milliseconds to wait before sending a batch, even if the batchSize hasn’t been reached.
transport.useBeacon
boolean
default:"true"
When true, Radar will attempt to use the navigator.sendBeacon() API to send any queued events when the user navigates away from the page. This is highly reliable for capturing last-minute interactions.
transport.blockedEvents
string[]
default:"[]"
An array of event names to prevent from being sent. For example, ['$pageview'] would block all automatic pageview events.