Pregunta

I was wondering whether anyone could see anything wrong with the way I have setup this tracking as I have been testing it on and off for several days and it doesn't seem to want to track.

#index 

<head>
    ...
    <script type="text/javascript" async="" src="http://www.google-analytics.com/ga.js">
    ...
</head>


<body>
    ...
    <div class="product-buy">
        <a href="<%= url_with_protocol(general.url)%>" onClick="_gaq.push(['_trackEvent', 'General', 'Click', '<%= general.title %>', '<%= general.position %>']);" target="blank">Learn More/Visit Site</a>
    </div>
    ...
</body>

I believe I have followed the analytics guide to a tee but no data seems to be passing?

Any help people can offer really would be appreciated.

¿Fue útil?

Solución

The issue was that I was passing the 3rd argument of '1' as a string instead of an integer.

It should have been where general.position is turned into an integer with .to_f and the speech marks are moved so that analytics doesn't read it as a string.

<body>
    ...
    <div class="product-buy">
        <a href="<%= url_with_protocol(general.url)%>" onClick="_gaq.push(['_trackEvent', 'General', 'Click', '<%= general.title %>', <%= general.position.to_f %>]);" target="blank">Learn More/Visit Site</a>
    </div>
    ...
</body> 
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top