List of javascript variables for Google Tag Manager. Each variable is an analogue of the corresponding built-in variable from the "Clicks" category. However, it applies only to buttons, regardless of the level of nesting.
Using these variables, you can work with buttons as easily as you can with links.
Normally, it completely repeats the behavior of built-in variables
<button> <-- {{Click Element}} and {{Click Button Element}}
Some text
</button>
But in the case of nested variables, the result always points to the nearest button, regardless of the nesting level of the {{Click Element}}.
<button> <-- {{Click Button Element}}
<span>Some text</span> <-- {{Click Element}}
</button>
<button> <-- {{Click Button Element}}
<span>
<i class="icon"></i> <-- {{Click Element}}
<span>Some text</span>
</span>
</button>
- Enable build-in {{Click Element}} variable.
- Create Custom JavaScript variable.
- Copy one of the codes below according to your needs and paste it into the body of the Custom JavaScript variable.