How to refer a Pre-configured variable in Custom JavaScript

Hi,

I’d like to refer a Pre-configured variable like {{ClickElement}} in my Custom JavaScript function. But I found that impossible because the browser told me that the “{” is not expected, or the variable is undefined if I use ClickElement without the braces.

Now I wonder if there is any way to use Pre-configured variables in Custom JavaScript functions. Maybe I just go to the wrong way.
If not, is there another way to implement similar target?

Thank you in advance.

I have figured out this.
It seems I can use MatomoTagManager.dataLayer.get(“mtm.clickElement”) or MatomoTagManager.dataLayer.values[“mtm.clickElement”] to get the values of these Pre-configured Variables.

See also this topic: Use Variables in Custom JavaScript Variable