Well, I can at least get you a little bit farther:
The JavaScript file generated by Tag Manager is invalid:
container_T1zrjXa0_preview.js
Templates['CustomJsFunctionVariableda25e980'] = (function () { return function (parameters, TagManager) { this.get = function() {
var el = {{Find closest}}({{Click Element}}, 'div[data-target^="#modal"]');
return typeof el !== 'undefined' ? {{Click Text}} : undefined;
}; } })();
These {{Click Element}} and {{Find closest}} should not show up in the code.
I don’t know if this is a bug in MTM or a typo in your Custom Variable, but it would help if you could post this custom variable here.
Great, thanks for pointing this out. The custom variable was for created to try and extract some info based on a click element. This is the custom variable, it’s something that we have previously used in GTM, so hoped it would be transferrable:
Would you recommend that I pause this tag for the time being? Or should I just remove those variables and test the preview again?
Also could I ask that you remove the link to the preview from your previous message as I wasn’t aware that these messages were on the public forum when I replied earlier.
@thomas_matomo - thanks for spotting that, I guess I had the previous GTM naming still for those variables. These are now corrected so hopefully all the variables are correct in this particular custom js now. {{Find closest}} is created and the code is the previous code that I’d sent to Lukas on this thread.
@Lukas - in which case I think the below is the code (now updated as above):
function() {
var el = {{Find closest}}({{ClickElement}}, ‘div[data-target^="#modal"]’);
return typeof el !== ‘undefined’ ? {{ClickText}} : undefined;
}
Let me know if you think there is anything else that might be causing a fault here.