Use the Collected attributes setting in Data masking to choose which HTML attribute values Contentsquare keeps.
HTML attributes are code labels attached to website elements. Examples include data-testid, role, and data-action. Contentsquare always collects which attributes an element has. On masked pages, it removes their values and keeps only the names, unless the attribute is on your collected list.
In Session Replay, a kept value can help you identify specific elements involved in user interactions in the event stream and search results. Collected attributes do not change the visual appearance of the replay.
Before you begin
- Data masking settings are configured per project.
- Admin and Expert user level access can edit collected attributes.
- Changes apply only to data collected after you save the setting. They are not retroactive.
- The attribute name must match the name used in your website’s code.
Attributes collected by default
- Click your profile icon.
- Select Projects and users.
- Select Data masking.
- Scroll down to Collected attributes.
- Select View.
The section lists attributes in two groups:
- Attributes collected by default
- Attributes added by you
The following attributes are collected by default:
- role
- data-action
- data-component
- data-track
- data-analytics
- data-testid
These six attributes are locked and cannot be removed.
Attributes required to render Session Replay
Contentsquare also collects the following attributes to render Session Replay correctly. These attributes are required and cannot be excluded from collection:
- id
- class
- style
- srcset
- sizes
- rel
- type
- width
- height
- media
- align
- dir
- bgcolor
- color
- border
- colspan
- rowspan
- cols
- rows
- size
- start
- slot
- data-cs-override-id
Add an attribute
Review the values an attribute may contain before adding it. For more information about your responsibilities, see Your responsibilities for personal data collection with Contentsquare.
- Enter the attribute name in the attribute field.
- Enter the name without brackets. For example, enter aria-selected. An attribute entered with brackets will not match anything on your site.
- Add the attribute to the list.
- Review the warning before saving.
- Click Add.
- Click Save.
Wildcards are not supported. For example, adding data-* does not collect every attribute beginning with data-.
Changes may take a short time to take effect. They apply only to data collected after you save the setting.
How the collected attributes affect masking
On a masked page or element, adding an attribute to the collected list can allow Contentsquare to collect its value unmasked. This can help you use the value to define events and identify elements in Session Replay.
Collected attributes do not:
- Override an explicit mask applied to the element or attribute.
- Make masked text, media, or other element content visible.
- Make values typed into input or textarea fields visible.
Before adding an attribute, review the values it can contain.
How collected attributes appear in Session Replay
Collected attributes do not create a new visual layer in a replay.
When available, their values can help you identify elements in the event stream and search results. For example, data-testid="add-to-cart" can help you distinguish an add-to-cart button from other buttons.