Setting up goals is one way to objectively measure engagement level of a website over time, while serving as a diagnostic tool to identify areas of concern. One common goal to measure is the ‘contact us’ form. This is a form where visitors can send inquiries, complaints, or any message to stake holders of the website.
Setting up goals in Google Analytics is relatively easy: identify the URLs of pages where visitors must access to complete a transaction. It may be three or four steps for a shopping cart or a click away if you’re measuring whitepaper downloads or newsletter subscriptions. Going back to the ‘contact us’ page, it is also pretty straightforward, just fill up the form and press the submit button, you have one website engagement waiting to be measured.
However, there are instances where the ‘contact us’ form also shares the same URL as the thank you page — the page generated after you click the submit button and symbolically accepts the message with the ‘Thank you for your message. We will get back to you soon’.
a) Place the following code on the supposed ‘thank you’ page. This creates a new pageview instance different from the ‘contact us’ form page. Also, the tracking code must be placed above this code so necessary parameters are set before Google Analytics will read the new code we incorporate onto the page.
I guess it’s quite a challenge to take this suggestion simply because the page in question serves both ‘contact us’ and ‘thank you’ pages. So unless you’re willing to do some IF-THEN condition to load the <body> tag, it’s tough to use this.
b) Another method is to integrate the same code right at the moment the submit button is pressed. At the ‘contact us’ form page, the submit button needs to be modified so that
<form action="[some script]" method="POST">
<form action="[some script]" method="POST" onsubmit="pageTracker._trackPageview('/ContactThankYou')";>
Hopefully, this article is helpful in implementing goals using Google Analytics.