The following is the Google Analytics code added just before closing / head on the html page.
var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-xxxxxxxx-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'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();
Next, I raise an event ... on success or failure ...
$.ajax({ url: "/xxx/xx/", type: "POST", data: { name: q, seme: o, profile: x } datatype: "html", success: function (f) { _gaq && _gaq.push(["_trackEvent", "contactform", "success", i, p]) }, error: function (f) { _gaq && _gaq.push(["_trackEvent", "contactform", "crash", i, p]) } });
But the event was not recorded ... I was waiting to see something in the last 4 days .. I have performed several tests, but it does not appear in the analytics ... Am I doing something wrong? Do I need to add an extra line to the main Google Analytics snippet added to the title tag?
GA tracks normal data, but not these events.
source share