RTN Docs

Web SDK · v0.6.0

Privacy Controls

Built-in redaction, extra redaction rules, and the beforeSend hook.

Built-in protection

  • URLs: values of sensitive parameters such as token, code, password, email, phone, tckn, and iban, and any value that contains an email address, are replaced with redacted.
  • Referrers: an external referrer is sent as its origin only. A same-origin SPA referrer keeps its path and query with sensitive values redacted.
  • Properties: contact fields and email-like strings in track and page properties are redacted before they are queued.
  • Identify: identify events that carry an email or phone number are never written to localStorage; they are sent immediately.
  • Contact data: emails are trimmed and lowercased; phone numbers lose spaces, dashes, and parentheses. Invalid values are dropped, and debug: true logs a warning.

Contact data from the browser is treated as unverified by the backend. Use the server API as the source for messaging and marketing permissions.

Extra redaction rules

rtn.init('WRITE_KEY', {
  redactParams: ['session_ref', 'voucher'],
  redactPropertyKeys: ['national_id', 'loyalty_card'],
});

Change or drop events with beforeSend

beforeSend runs before an event is queued. Return the event, possibly modified, or null to drop it.

rtn.init('WRITE_KEY', {
  beforeSend(event) {
    if (event.event === 'internal_debug') return null;
    if (event.properties) delete event.properties.internal_note;
    return event;
  },
});

If the hook throws, the event is dropped so a broken scrubber cannot leak data.

On this page