The easiest way to do this is to create a separate Joomla article as your thank you page and add your Analytics code there.
Then, in your form, you will want to redirect to that thank you page after submit.
Create an END SUBMIT piece.
Form Properties > Advanced Tab > More Options > Submit Pieces Tab
Then click on "CUSTOM" in the END SUBMIT section and paste in the following code:
$this->execPieceByName('ff_InitLib');
ff_redirect('/myThankYouPage.php');
If you are redirecting to a page outside of your server, then it should be coded like this:
$this->execPieceByName('ff_InitLib');
ff_redirect('http://www.yourDomain.com/page.html');
If your form is displayed in an iFrame and you want the page you are redirecting to, to break out of the iFrame and appear in the main window, use this code instead:
$this->execPieceByName('ff_InitLib');
ff_redirect('/myThankYouPage.php', 'parent');
or, if redirecting to a page outside of your server:
$this->execPieceByName('ff_InitLib');
ff_redirect('http://www.yourDomain.com/page.html', 'parent');
(Remember to replace the /myThankYouPage.php or
www.yourDomain.com/page.html with the correct URL for your thank you page!)
Once you have added that code, click on the SAVE button at the bottom of that screen. You will then be taken back to the form's property screen. Click on SAVE PROPERTIES to save the changes to the form's properties, and then click on the SAVE icon in the upper right-hand corner of the screen to save the form itself.