Clink
August 27, 2013, 9:06pm
1
I can see that others got the same problem with onclick=“piwikTracker.trackGoal();”. I have tried to use it for the submit button for a contact form and for other buttons but it doesn’t seem to do anything. I have the right goal number in it.
I have also tried “onsubmit” but nothing… what could be wrong?
halfdan
(Fabian Becker)
September 10, 2013, 9:04am
2
Are you using the asynchronous or the syncronous tracker? (JavaScript Tracking Code)
Clink
September 10, 2013, 10:48pm
3
Hmmm… I’m not 100% sure about that. This is inserted post-footer (could there be something wrong with the code?):
<!-- Piwik -->
<script data-cfasync="false" type="text/javascript">
var _paq = _paq || [];
_paq.push(['setRequestMethod', 'POST']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://www.mydomain.com/piwik//";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="http://www.mydomain.com/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Code -->
and then I use onclick=“piwikTracker.trackGoal();” to track submit buttons etc. (but it doesn’t work).
Thanks for your help
habakuk
(habakuk)
June 5, 2014, 12:51pm
4
I have the same problem and the same setting.
I get this error in the console:
ReferenceError: piwikTracker is not defined
piwikTracker.trackGoal(2);
Ciao!
Stefan
habakuk
(habakuk)
June 5, 2014, 1:26pm
5
The solution:
<form ... onclick="_paq.push(['trackGoal', 2]);">