cleaning redundant whitespaces from segment labels (#2093)

This commit is contained in:
trean
2026-01-22 19:37:25 +01:00
committed by GitHub
parent 2ea65872a2
commit 59e1958818
@@ -29,10 +29,13 @@ const nameMapper = (url) => { // Mapping names based on pathname for Segment
/* DOM helpers */
/***************/
const handleClickInteraction = (event) => {
const rawLabel = event.target.getAttribute('data-metric-label') ?? event.target.innerText;
const cleanedLabel = rawLabel ? rawLabel.replace(/\s+/g, ' ').trim() : '';
const payload = {
...PAYLOAD_BOILERPLATE,
location: event.target.getAttribute('data-metric-loc') ?? '',
label: event.target.getAttribute('data-metric-label') ?? event.target.innerText,
label: cleanedLabel,
action: 'clicked'
};