tag-manager
tag-manager copied to clipboard
Variables in Custom JS Funtion Variable
Description:
Resolves #212
Review
- [ ] Functional review done
- [ ] Potential edge cases thought about (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
- [ ] Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
- [ ] Security review done
- [ ] Wording review done
- [ ] Code review done
- [ ] Tests were added if useful/possible
- [ ] Reviewed for breaking changes
- [ ] Developer changelog updated if needed
- [ ] Documentation added if needed
- [ ] Existing documentation updated if needed
@ulcuber Does this code works for you ?
function () { if ({{ClickElement}}) { return {{ClickElement}}.getAttribute('class'); } else { return "111"; } };
@AltamashShaikh checked this issue. It was just creating variable. I forgot to evaluate variable. Now it works
@AltamashShaikh @ulcuber the reason I didn't implement it I believe was because I couldn't figure out how to make this work without using eval
. I believe in some cases this wouldn't work maybe like below?
var {{ foo }} = {{ bar }};
Not sure if such cases would work? Or if the variables would only work in few specific places?