trackEvent not working on chrome

Hello everybody ,

I am using piwik to track some events on my website .

i used to track click on links so i added something like this :

<a href="LInkHere" onClick="javascript:pushToPaqService('Service', 'LINK');">the link</a>

The script looks like that :

    function pushToPaqService(name,value){
    _paq.push(['trackEvent', name,value]);

Its working on FireFox and all events are tracked , but i still getting no information when i use Chrome .

I dont have any errors in my logs/console .

The DoNotTrack is desabled .

I dont have any ip excusion .

Any idea about that please :).


Hi @Bocasi
onclick shouldn’t need a javacript: part, but only the function. So you should be able to write

<a href="LInkHere" onclick="pushToPaqService('Service', 'LINK');">the link</a>

I am not sure if this is the cause of your problem.

Hi @Findus23

Thank you for the reply .

I dont think that this is the cause .

I used to change the script and i used also to use javascript .

The function pushToPaqService is executed successfully , but i dont see results on my dashboard .

Then can you check if a http request is sent when the javascript is executed.

It should look similar to

i found that the http request wasn’t sent .

Only in Chrome or also in other browsers?

At least this means that the piwik server backend isn’t at fault.

Anothing you can test: Add an link with “#” as href: <a href="#" onclick="pushToPaqService('Service', 'LINK');">the link</a>

Maybe the function doesn’t get executed correctly as the browser has already left the page before the request can be made.

Its solved ,

It was only on Chrome , i deleted all cookies and cash from chrome, i disactivated a proxy that existed , an i found that in some elements i used onclick not onClick .

Thank you for your help @Findus23 .