If you have a landing page you could add the custom tracking code there (only inject the tracking code if they arrive successfully from your form page). You could also use the tracking API (Google Analytics API) to track the submission if it's successful by adding a listener to the XForm AfterSubmitPostedData event with the relevant code there.
Here's an example: http://www.frederikvig.com/2009/10/sending-confirmation-email-to-the-user-when-using-episerver-xforms/
I would like to track Xform submission in my site. I have an xform with input fields and validation. So, I would like to track submission with valid input. If it is not valid data, I don't want to track that submission.
Any help is appreciated !