Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up Google Analytics Goal for ajax form submissions

I have a contact form that is submitted via ajax and upon a successful submission, a thank you/success message is displayed.

Additionally, I've set up a goal (Goal Completion URL) in my Google Analytics account for visits to a thank you page.

This page does not exist.

Any thoughts/suggestions on how I can set up tracking successful form submissions via this method?

like image 418
mykisscool Avatar asked Mar 28 '12 13:03

mykisscool


People also ask

How do I set a form submission goal in Google Analytics?

Step 1: First, log in to your account and select the website or property on which you wish to track form submissions. Step 2: Click on Admin. Step 3: After that, navigate to Goals, which is located under the View column. Step 4: Click on the + New Goal button.

How do I track submissions in Google Forms Google Analytics?

How to Track Form Data in Google Analytics. Once you've enabled form tracking, you can review form activity and data in your Google Analytics account. Google Analytics can record anything from page views to button clicks. Formstack automatically creates these events on your form when you enable the plugin.


1 Answers

You can use virtual pageviews. For each step of the process, add a call to

_gaq.push(['_trackPageview', '/ajax-contactForm/PAGE-or-STEP-NAME.html']); 

This will register as a pageview and can be used as a step in the goal.

See virtual pageviews in the GA docs.

Or, to set it up as an event goal as Eduardo suggested, see The New Google Analytics: Events Goals

like image 166
jk. Avatar answered Sep 25 '22 12:09

jk.