如何解决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 举报,一经查实,本站将立刻删除。