I have a WordPress site with the CFormsII plugin installed using AJAX. I've been researching and trying to find out how to integrate Google event tracking code. I've found multiple examples but nothing that works.
About the closest I've gotten is finding the JavaScript code to call the event, I just can't find out where to put it
_gaq.push(['_trackPageview', '/cforms-goal/']);
I've tried echoing this out with script tags in the my-functions.php file in both my_cforms_ajax_filter($params) and my_cforms_action($cformsdata) but whenever I add in the echo statement, I receive the "One moment please..." And nothing gets submitted and the event isn't tracked.
I'm sure this is probably my lack of understanding of what's going on with the AJAX request. Maybe I can't echo out the JavaScript there? Maybe it boils down to how can I execute JavaScript code from the my-functions.php file?
I had the same problem and the solution I came up with was to create a new ok page and in core form admin/email options I checked Enable alternative success page, and I specified this new page as an alternative page.
Later, in google analytics I set up a new goal by url, setting this new page as a goal.
Hope it helps