Extracting XPath for Goal events
To discover the page element XPath, you need to tell CUX which HTML element you have in mind. We’ll need the element class or ID that’s part of HTML attributes.
- Navigate to the page on your site.
- Find the element you want to track in your Goal.
- Right-click the element.
- Use the “Inspect” or “Inspect element” function. This opens the developer tools window or pane. In the developer tools window, a part of the HTML code that represents the chosen element is selected.inspect page cux.io
- Copy the HTML element class or ID.
- Paste the copied value in the XPath field of the Goal creator. After a short moment, CUX shows you suggestions for the XPath.
- Select the option. CUX automatically enters the XPath value into the field. That’s all you need to do!
NOTE: If you use xPath for the Click event – always select “Matches” in the Comparison tab. If you use regular expressions instead of XPath, choose “Contains (regexp)”.