Control how LogRocket records the DOM

LogRocket records a "video" of your users' sessions by logging diffs in the DOM via MutationObserver.

By default, LogRocket does not record any password inputs, DOM trees that contain the _lr-hide class, or any element with the data-private attribute.

Disable DOM Logging

isEnabled - Boolean

optional (default - true)

If you would like to disable all DOM recording regardless of class or attribute, you may set isEnabled to false

LogRocket.init(YOUR_APP_ID, {
  dom: {
    isEnabled: false,
  },
});

Sanitize all user input fields

inputSanitizer - Boolean

optional (default - false)

With this set to true, LogRocket will automatically obfuscate all user-input elements like <input> and <select> from session recordings. None of that data will be recorded or sent to LogRocket.

Nodes can be whitelisted with the data-public attribute. This attribute will not affect existing data-private privacy settings.

LogRocket.init(YOUR_APP_ID, {
  dom: {
    inputSanitizer: true,
  },
});

Sanitize all text fields

textSanitizer - Boolean

optional (default - false)

With this set to true, LogRocket will automatically obfuscate all text nodes from all session recordings. None of that data will be recorded or sent to LogRocket.

Nodes can be whitelisted with the data-public attribute. This attribute will not affect existing data-private privacy settings.

LogRocket.init(YOUR_APP_ID, {
  dom: {
    textSanitizer: true,
  },
});

Accessing Private Assets

baseHref - String

optional (default - null)

If client accesses your app on a private domain (or from a Cordova app), then LogRocket won't be able to fetch CSS/image assets for playback (see Testing on localhost/VPN for more information). To get around this limitation, you can specify a baseHref from which LogRocket will fetch assets. Make sure that this domain is publicly accessible, and that it contains the same assets and folder structure as the private domain:

LogRocket.init(YOUR_APP_ID, {
  dom: {
    baseHref: 'https://assets.example.com/',
  },
});