There is no "one-size-fits-all" solution for this. Your solution is unique to how your site is setup. If you want some pointers, you will need to provide details about how your site is setup. For example, does your form have a unique URL the visitor has to go to? Or is it some button you click and you get an overlay on a page? Is it embedded as an iframe on your site?
Same with the "thank you" / confirmation page. But also, do you care about tracking only submit attempts (as in, user clicks the submit button), or do you only want to track if a user successfully submits the form? If the "thank you" page has a unique URL, can the user only get to it upon successful completion? etc..
It would also be helpful to provide a URL to the form.