How can I hook into the system Contact form Message Sent process and alter the HTML generated? I have a Drupal site where I am using the sited-wide system Contact to allow visitors to send messages to the site owner.  Once a visitor submits the form, the user is redirected to the home page and a sticky appears at the top reading:

Your message has been sent.

My question then, is it possible to change this message and add some HTML to the output?  Ideally I would add some javascript to create a virtual page view for the Google Analytics account so that I can track it as a Goal Conversion.

I imagine this would be a hook_ function sitting in my template file, but I'm relatively new to this process.
Sure, just use hook_form_alter() and add a callback to $form['#submit']. The easiest way to find your form's id is inspecting it using firebug. This article has a lot more detailed info: http://www.lullabot.com/articles/modifying-forms-drupal-5-and-6.

In short:


Find the id for the contact form, "contact_mail_page" or something (notice how hifens turn to underscores)
In a new custom module implement either: yourmodule_form_alter($form_id, &amp;$form, 'contact_mail_page') or yourmodule_form_contact_mail_page_alter($form_id, &amp;$form)
Modify the contact form as you want using the $form variable passed by reference