> For the complete documentation index, see [llms.txt](https://docs.peakcommerce.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.peakcommerce.com/integrations/analytics-and-data/heap-analytics/how-do-i-hide-sensitive-elements-within-heap.md).

# How do I hide sensitive elements within Heap?

For complete info on how to hide sensitive elements from Heap, see the **Sensitive Data** sections of the Heap installation guide:

* [Web](https://developers.heap.io/docs/web#ignoring-sensitive-data-and-pii)
* [iOS](https://developers.heap.io/docs/ios#ignoring-sensitive-data-and-pii)
* [Android](https://developers.heap.io/docs/android#ignoring-sensitive-data-and-pii)
* [React Native](https://developers.heap.io/docs/react-native#ignoring-sensitive-data-and-pii)

### Ignoring Sensitive Data and PII

#### Target Text Autocapture toggle

Admins can control the capture of sensitive information that lives on the target text of elements by turning on the Target Text Autocapture toggle on the **Account** > **Manage** > [Privacy & Security\*\*](https://heapanalytics.com/app/manage/privacy-and-security).

Please note that disabling target text entirely might make creating event s more difficult. Also, if you have this setting enabled while using the APIs listed below (e.g. disableTextCapture), then the most privacy-conscious setting will win.

#### Precise data redaction via Heap Redact

You can redact a page title or an element’s target text by using `data-heap-redact-text`. The underlying interactions will still be captured (ex. pageview, click) but the sensitive parts will be replaced by \*\*\*\* in your Heap dataset before it leaves the browser.

Code snippet for redacting a page title:

HTML

```html
<html>
  <head>
    <title data-heap-redact-text>Page Title</title>
  </head>
...
<html>
```

Code snippet for redacting the text of an element:

HTML

```html
<div data-heap-redact-text>
  Social Security Number
</div>
```

If sensitive data lives in an element’s target text, attribute, or in a page title, you can hide it from Heap by using `data-heap-redact-attributes`. The content of these attributes will be redacted before it leaves the browser. Keep in mind that if there are no values defined for `data-heap-redact-attributes`, nothing will be redacted.

The underlying interaction will still be captured (ex. a click) but the sensitive part will be replaced by \*\*\* in your Heap dataset before it leaves the browser.

Code snippet for redacting sensitive data living in an attribute:

HTML

```html
<div data-heap-redact-attributes='attr1,attr2'>
    <div>
      <p id='customer info' attr1='something sensitive' attr2='something even more sensitive' attr3='completely safe'>Customer Profile</p>
    </div>
</div>
```

Note that the `id` attribute specifically can't be redacted using `data-heap-redact-attributes`; in the unlikely event that your app places sensitive data in the `id` attribute, you may consider using `heap-ignore` on the element in question to make sure that the `id` values are not captured.

#### Global data redaction via Disabling Text Capture

If you wish to redact the text content of elements on all pages (not locally), then you can set `disableTextCapture`. `disableTextCapture` will redact all target text on your website. We recommend adding [Snapshots](https://help.heap.io/heap-administration/data-management/snapshots/) when text collection is necessary.

JavaScript

```javascript
heap.load("YOUR_APP_ID", {
    disableTextCapture: true
});
```

Note that `disableTextCapture` doesn't work on page titles. To selectively redact a page title, use the following snippet:

HTML

```html
<title data-heap-redact-text='true'>
```

> By adding **heap-ignore** to an element, you exclude an element from being tracked in its entirety, not just the sensitive part(s). **heap-redact** will capture that an event occurred, but redact the data attributes.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.peakcommerce.com/integrations/analytics-and-data/heap-analytics/how-do-i-hide-sensitive-elements-within-heap.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
