Magento1.5.0.1CEインストールでイベントトラッキングが機能しません。コードapp/code / local / Mage / GoogleAnalytics / Block/GA.phpを次のように更新しました。
<!-- BEGIN GOOGLE ANALYTICS CODE v2 -->
<script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
' . $this->_getPageTrackingCode($accountId) . '
' . $this->_getOrdersTrackingCode() . '
_gaq.push(["_trackPageLoadTime"]);
(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\';
(document.getElementsByTagName(\'head\')[0] || document.getElementsByTagName(\'body\')[0]).appendChild(ga);
})();
//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->';
次に、ホームページにイベント追跡リンクを追加しました。
<a href="/page-to-link-to" onClick="_gaq.push(['_trackEvent', 'Homepage Events', 'Category Headings', 'Event Im Tracking']);">LINK</a>
だから私はfirebugを介してfirefoxでこれをテストしましたが、イベントは機能していません。誰かが兄弟を助けてくれませんか?
また、コードは開始タグの後に挿入されています。
レンダリング方法は次のとおりです。
<!-- BEGIN GOOGLE ANALYTICS CODE v2 -->
<script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX-X']);
_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';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->
ありがとう!