admin管理员组文章数量:1400524
Trying to setup a custom JavaScript in GTM where the innerHTML value is checked for X and if it is X fires.
Here's what I have so far but it's not firing correctly
function() {
var el = document.getElementById('ltrNumPlaceholder');
if (el == null) return 0;
return parseInt(el.innerHTML);
}
I also tried this but GTM plains there there is a syntax error on a line that doesn't exist. (GTM error message for the below is: "Error at line 5, character 2: Parse error. ')' expected.")
function(){
var stepNum = document.getElementById('ltrNumPlaceholder').innerHTML;
if(stepNum == 2)return parseInt(stepNum);
};
Thanks for your help in advance.
Trying to setup a custom JavaScript in GTM where the innerHTML value is checked for X and if it is X fires.
Here's what I have so far but it's not firing correctly
function() {
var el = document.getElementById('ltrNumPlaceholder');
if (el == null) return 0;
return parseInt(el.innerHTML);
}
I also tried this but GTM plains there there is a syntax error on a line that doesn't exist. (GTM error message for the below is: "Error at line 5, character 2: Parse error. ')' expected.")
function(){
var stepNum = document.getElementById('ltrNumPlaceholder').innerHTML;
if(stepNum == 2)return parseInt(stepNum);
};
Thanks for your help in advance.
Share Improve this question asked Nov 13, 2014 at 15:14 JPFotozJPFotoz 1051 gold badge4 silver badges15 bronze badges 1- To circumvent the problem you could use a DOM macro for the element with the id "trNumPlaceholder" and then a lookup table macro based on that. – Eike Pierstorff Commented Nov 16, 2014 at 19:26
1 Answer
Reset to default 5To fix the error message, just remove your semicolon at the end of the function (after the closing curly bracket), and that should work.
本文标签: Error in Custom Google Tag Manager JavaScriptStack Overflow
版权声明:本文标题:Error in Custom Google Tag Manager JavaScript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744273231a2598285.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论