我正在尝试将 Google Analytics 代码插入网站。这段代码被放在每一页上:
<!--Google Analytics account for all smithmicro sites-->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-166807-32']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_addIgnoredRef', 'smithmicro.com']);
_gaq.push(['_setCustomVar', 5, 'ecommerce', 'fastspring', 3]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = "https://ssl.google-analytics.com/ga.js";
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
<!--END Google Analytics account for all smithmicro sites-->
然后这段代码是一个购买按钮:
<form method="POST" action="https://sites.fastspring.com/smithmicro/checkout/23492?source=microsite " target="_top" onsubmit="_gaq.push(['_linkByPost', this]); return false;" ><input type="submit" value="Buy Physical" class="button" /></form>
如果我取出“return false;”,它就可以正常工作。但是,有人告诉我,分析工作需要在那里。我尝试将它从一个表单更改为一个具有相同参数的链接,并得到了相同的结果。”