HumanBehavior SDK automatically redacts sensitive data using rrweb’s built-in masking. All input fields are redacted by default, ensuring privacy compliance while maintaining the value of your analytics.

Automatic Redaction

The SDK automatically redacts sensitive data without any configuration:
  • All Input Fields: Automatically masked (maskAllInputs: true)
  • Password Fields: Always masked (maskInputOptions: { password: true })
  • Real-time Protection: Data is masked before being recorded
  • No Configuration Required: Works out of the box

Unredacting Specific Fields

You can selectively unredact fields that you want to track (except passwords, which remain protected):
// Unredact specific fields for tracking
tracker.setUnredactedFields([
  '#public-comment',
  '.feedback-input',
  'input[name="username"]'
]);

Accessing the Tracker Instance

React/Next.js:
import { useHumanBehavior } from '@humanbehavior/react';

function MyComponent() {
  const tracker = useHumanBehavior();
  
  const handleUnredact = () => {
    tracker.setUnredactedFields(['#comment-field']);
  };
}
Angular:
import { HumanBehaviorService } from '@humanbehavior/angular';

constructor(private humanBehavior: HumanBehaviorService) {}

unredactFields() {
  this.humanBehavior.setUnredactedFields(['#comment-field']);
}
Vue:
import { useHumanBehavior } from '@humanbehavior/vue';

const tracker = useHumanBehavior();
tracker.setUnredactedFields(['#comment-field']);
Vanilla JavaScript:
// The tracker instance is available globally after initialization
window.HumanBehaviorTracker.setUnredactedFields(['#comment-field']);

Common Use Cases

Public Forms

// Unredact public feedback fields
tracker.setUnredactedFields([
  '#feedback-form textarea',
  '.public-comment',
  'input[name="topic"]'
]);

User Experience Research

// Unredact fields for UX research (but keep passwords protected)
tracker.setUnredactedFields([
  '.search-input',
  '#product-feedback',
  'input[name="category"]'
]);

Debugging Mode

// Temporarily unredact fields for debugging
tracker.setUnredactedFields([
  '#debug-input',
  '.test-field'
]);

// Re-enable redaction later
tracker.redactFields([
  '#debug-input',
  '.test-field'
]);

Cross-Page/Component Usage

Important: When using redaction methods across different pages or components, you need to access the tracker instance again:
// ✅ Correct - Get fresh tracker instance
const tracker = useHumanBehavior(); // React
// or
const tracker = window.HumanBehaviorTracker; // Vanilla JS

tracker.setUnredactedFields(['#new-field']);

// ❌ Incorrect - Don't reuse old references
// const oldTracker = someOldReference; // This might be stale

API Reference

MethodDescription
setUnredactedFields(fields)Unredact specific fields
clearUnredactedFields()Redact all fields (everything becomes redacted)
redactFields(fields)Redact specific fields
hasUnredactedFields()Check if any fields are unredacted
getUnredactedFields()Get currently unredacted fields

Privacy & Compliance

  • Automatic Protection: All sensitive data is protected by default
  • Selective Unredaction: Choose which fields to track based on your needs
  • Password Protection: Password fields cannot be unredacted
  • Compliance Ready: Supports GDPR, HIPAA, and other privacy regulations
The SDK automatically protects all input fields. Only unredact fields that you specifically need to track for analytics purposes. Password fields remain protected regardless of unredaction settings.