Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have some nice ajax contact/enquiry forms etc on a website I'm working on which are working great (and degrade gracefully).

I'd like to make use of Google Analytic's 'Goals' feature. The trouble is, the only way I can see this could work for my form is if it redirected to another page (be it a thank-you page or similar) after submission, then I can enter that url at a page people only visit after they've submitted my form. I can see how this would work for my non-JS visitors (if any even have it disabled!), but is there any way to track when an AJAX form has been submitted?

Thanks

Edit: I should add that I know I can work out manually the conversion rate and so on/so forth by the number of enquiries I receive, but why not try and make things easier for mysef? :-)

share|improve this question

1 Answer 1

You could use Google Analytics' functionality to log a pageview for non-existent page URL when your form is submitted. This fake URL can then be used in your goal.

The code for logging a fake pageview is as follows:

_gaq.push(['_trackPageview', '/fake/page/url'])
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.