Event tracking from onclick


#1

Hi,

Can anyone give me simple and tested receipt for this? I’m trying to make it work, but I feel like going in circles.

I have the feeling that sometimes space after ; matters…

At the moment I’m using this:

<input type="submit" value="Go" onclick="_paq.push(['trackEvent', 'Category', 'GO Button clicked']); ">

or

<input type="submit" onclick="_paq.push(['trackEvent', 'Category', 'Name', 'Description', 8.18]); " value="Click" name="commit">

but this seems to work in chrome, but not in FF? What would be proper way to do this so I’m sure that I will record all clicks on this button in FF, Chrome, Safari, and others?

I’d say my solution “sometimes works and sometimes not” - it’s not good enough. Help? :smile:

cheers,
Lio


(Matthieu Aubry) #2

Hi Lio,

It should work in both FF and Chrome. do you maybe get an error in the javascript console in your browser?


#3

No - unfortunately nothing. If I have error this would be easy :wink:

However I have noticed that small amount of FFs do register event - no idea what to do.

I did some research since writing above post and it looks like this:

In firebug (network pane) after click I can see request which is trying to get to piwik server, but it never reaches the server. However when I copy url he was trying to reach and paste it in address bar - it registers event properly.

I didnt go that far to use sniffer and check if the request actually leaves browser and goes to router. Maybe if I have time I will go for it…