Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Analytics Event Tracking not working Magento 1.5.0.1
    text
    copied!<p>Event tracking is not working with my Magento 1.5.0.1 CE installation. I have updated the code app/code/local/Mage/GoogleAnalytics/Block/GA.php to:</p> <pre><code> &lt;!-- BEGIN GOOGLE ANALYTICS CODE v2 --&gt; &lt;script type="text/javascript"&gt; //&lt;![CDATA[ var _gaq = _gaq || []; ' . $this-&gt;_getPageTrackingCode($accountId) . ' ' . $this-&gt;_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); })(); //]]&gt; &lt;/script&gt; &lt;!-- END GOOGLE ANALYTICS CODE --&gt;'; </code></pre> <p>Then I added an event tracking link to my homepage: </p> <pre><code>&lt;a href="/page-to-link-to" onClick="_gaq.push(['_trackEvent', 'Homepage Events', 'Category Headings', 'Event Im Tracking']);"&gt;LINK&lt;/a&gt; </code></pre> <p>So I tested this in firefox via firebug and the events are not working. Can someone please help a brother out?</p> <p>Also the code is being inserted after the opening tag.</p> <p>This is how it renders:</p> <pre><code>&lt;!-- BEGIN GOOGLE ANALYTICS CODE v2 --&gt; &lt;script type="text/javascript"&gt; //&lt;![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); })(); //]]&gt; &lt;/script&gt; &lt;!-- END GOOGLE ANALYTICS CODE --&gt; </code></pre> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload