https://www.youtube.com/watch?v=KVYj4GBbclY
Since it wouldn’t be prudent to resolve the variable before the surrounding JavaScript code is executed, it follows that the TMG won’t resolve the variables until the custom HTML tag is inserted at the end of
. The value of the variable must match the value of the injected custom HTML tag. When you create a custom HTML tag in Google Tag Manager, you’re actually creating HTML elements that are added at the end of the element when the tag is activated. Now, when you add a Google Tag Manager variable to a custom HTML tag, use the {{variable name}} syntax. The main exception is for variables that are launched in strings, which Google Tag Manager must resolve before injecting them, otherwise the expression of the function itself will be launched in a string, which is not useful. For variables to wait for injection, this must mean that the variables themselves must be a kind of function call that the surrounding script executes and resolves once the tag is injected.