Enhanced WP-ContactForm is a popular WordPress plugin which adds a neat contact form to your WordPress blog. This can be completed with two small changes to you contact page.

1. Add the tracking code to the form.

On line 185 of wp-contactform.php

$results = '

' . $success_msg . '


change to

$results = '

' . $success_msg . '


All you are doing is adding the track page view which throws a page view into Analytics after the success message is displayed.

2. Move the tracking code

The original Google Analytics tracking code needs to be placed before the line you just added to the contact form. In WordPress I have placed the tracking code on the footer so I just copy & past the footer and header into the page template. The move the code from the footer into the header. If you use a WordPress plug in to manage your tracking you might need to use a plugin that places the tracking code in the head of your template or have a little play around.

All done sent a test contact and in Google Analytics this will appear as a page view.


Now just add that page as a goal and then Google Analytics will start to track conversion rates.


If you want you can add similar tracking when the contact form fails, this will track if the user enters an invalid field. This is useful to track if you think people may be having problems filling out the form. Although the above method applies to Enhanced WP-ContactForm the same concept should be applied to forms that just refresh the page, add the page view just after the confirmation statement and move the tracking to the top of the page.

One thought on “Track Google Goals on Enhanced WP-ContactForm

Leave a Reply