You can hide some page elements from the CUX script. When you do this, the hidden part is ignored and not shown in visit recordings or heatmaps. This is useful when you want to make sure sensitive data provided by your visitors is never recorded. You can hide static and dynamic (loaded by Ajax loader) page elements.
To hide an element from CUX, you need to modify your page HTML code. You can add the data-cux-exclude attribute to any HTML element. When the CUX script finds an element containing the exclude attribute, it replaces it with an empty DIV element. The styles for the hidden elements are retained. Thanks to this, the page rendered in CUX player or heatmaps won’t be destroyed.
Note that the operation of the CUX script affects only the data that goes to our database. The masking operation is transparent to your visitors. They can use and see all the elements freely.
It’s good to consider the elements you want to hide carefully. For example, if you’re going to protect data from forms, mark the input fields with the data-cux-exclude attribute. In this way, the CUX script can still record form submissions. You can then use these user actions as events to build waterfalls. Unmasked actions also appear on heatmaps.
Example. Hiding a contact form elements
Let’s say you have a contact form on your page that consists of 2 fields (name and message) and a button.
Your visitors enter their names and messages there. You don’t want either of these to appear in CUX. Add the data-cux-exclude attribute to the name and text area elements. The code sample shows you where to put the exclude parameter.
Thanks to this name and message fields are hidden, but you cans till track clicks on the “Submit” button.