Google Analytics分析代码与附加代码混合使用是否会出现问题

问题描述

这是我的问题。我的Google Recaptcha这段代码在我的身体上。

$(document).ready(function() {
    
// trigger loading api.js (recaptcha.js) script
    var reCaptchaFocus = function() {
    var head = document.getElementsByTagName('head')[0];
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = 'https://www.google.com/recaptcha/api.js?onload=onloadCallback0724&render=explicit';
    head.appendChild(script);

    // remove focus to avoid js error:
    // Uncaught Error: reCAPTCHA has already been rendered in this element at Object.kh
    document.getElementById('myslideform').removeEventListener('click',reCaptchaFocus);
    recaptcha_loaded0724 = true;
    

    };
    // add initial event listener to our basic HTML form
    document.getElementById('myslideform').addEventListener('click',reCaptchaFocus,false);


    
    
    });

在页脚中,我具有Google的分析代码。

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount','UA-3580320-24']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga,s);
})();
</script>

是否会发生冲突,因为它在不同区域的页面上两次使用了“ document.getElementsByTagName('script')[0]”吗?我只是问是因为Google Analytics(分析)代码最近停止工作了。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...