I have a very simple Custom JavaScript variable (which is a small function) with prototype.replace() that returns undefined in GTM:
function(){
var stringElem = {{Click Element}};
return stringElem.replace( 'HTMLSpanElement: ', '' );
}
No matter what I do, it returns undefined. {{Click Element}} is in dataLayer and is showing a non-empty string value. What am I doing wrong?