Many of our clients build their websites in Wordpress. We are strong supporters of Wordpress because of the large community that build great themes and plugins. One of the plugins that we often use is Contact Form 7. Contact Form 7 makes it super easy to setup a professional contact form with customized fields and easy validation.

Out of the box, when you submit a form using Contact Form 7 it shows a pop-up confirmation message to let the user know that their data has been sent. This is great from a user perspective, but if you want to track conversions in Google Analytics or another conversion tracking tool a submitted form does not have a different URL to use to trigger a goal. I've searched a few times trying to solve this issue but I usually end up using another more complicated solution.

I ran into this issue again today and tried once again to see if there was a simple solution. It turns out there is. At the bottom of the Contact Form 7 settings page is a section called Additional Settings. All you need to do is add this code to that area:

on_sent_ok: "location.replace('');"

That tells Contact Form 7 to goto a new URL after someone successfully completes a form. Just replace the with the URL of the confirmation page that you create (you'll, of course, need to create that confirmation page first).

Once you have that setting in place, your site visitors will be taken to your confirmation page. Assuming you have Google Analytics installed on all pages, you can build a goal that counts people who land on the confirmation page.

I was thrilled to get this working (and feeling lucky) so I went on to find a solution to another problem that often irks me when setting up conversion tracking on Wordpress. Wordpress will not let you put standard javascript tracking codes (i.e., Adwords Conversion Tracking) directly into a page or post. Typically, I have to have my developer create a custom field or shortcode to add conversion tracking. Sometimes I forget to add that to the spec or forget the shortcode which is a hassle.

I did some more searching and found a plugin called Creative Clans Embed Plugin. This plugin allows you to add a script to the top or bottom of every page. When using Adwords Conversion Tracking this is perfect because you only want to add the tracking code to the confirmation page (unlike Google Analytics where you want it on every page). As a side note: if you do want to add a code to every page I recommend using the Header and Footer.

Once I installed and activated Creative Clans Embed Plugin, I went to my confirmation page and pasted in the Adwords Conversion Tracking script into the "Scripts to Embedded at the Bottom" section of the plugin. I saved and tested. All done.

I'll finish this with a shameless marketing plug. While we love Contact Form 7, the biggest disadvantage is that all of your form data is sent via email. If something goes wrong with your email then the data is not saved. Additionally, you don't see any data about form submisssions over time or source of the submissions. We've built a web to lead service that works with Wordpress and other CMS tools that will let you submit leads to a reporting dashboard (with email alerts). Your data will be saved and you'll get great reporting and analysis capabilities. Learn more about our internet marketing dashboard.