Web Toastie


Social Media and SEO Blog of a Search Marketing Consultant

29 Oct, 2009

Contact Form 7 – Thank You Page

You are here: Home » General » Contact Form 7 – Thank You Page

The Contact Form 7 plugin for WordPress is recognised as one of the best for providing users with an enquiry form on WordPress installations. Although great at what it does, there is no standard option to redirect the user to a ‘thank you’ or ‘success’ page once the form has been submitted. The disadvantage of this is that if you are trying to monitor conversion tracking in Google Analytics (or other software) then you cannot judge how many people are sending enquiries. There is, however, a solution.

In the older versions of the plugin, you had to edit some of the source code to include a redirect rule, but it is much simpler with the latest version. The following steps show you how.

1. Log in to your WordPress dashboard, and go to the settings page for the Contact Form 7 plugin.

2. Scroll to the bottom of the page and ‘show’ the Additional Settings

3. Insert the following code:

on_sent_ok: "location.replace('http://www.website.co.uk/thank-you/');"

Obviously replacing ‘www.website.co.uk/thank-you/’ with the URL to your website thank you page.

Once you save the settings, that is all you should have to do. When a user next sends an enquiry, they will be redirected to your customised thank you page.

You will now be able to monitor conversions through Google Analytics. You also have the added advantage of providing the users with more information on the success page, which could help reduce the bounce rate, and keep visitors on the site for longer.

I don’t take any credit for finding this solution, as I eventually find out in the comments section of an article on the GrapeThinking website.

Update – the above fix no longer appears to work, particularly with WordPress 3. Please see the following post for an up-to-date fix:

Contact Form 7 – Redirect to a thank you page in WordPress 3

Enjoyed this post? Enter your email address here to receive updates whenever a new article is published on Web Toastie:

Delivered by FeedBurner

7 Responses to "Contact Form 7 – Thank You Page"

1 | Mark Henry

December 1st, 2009 at 5:04 am

Avatar

Good one Kieron..I just checked out the code and found the result. The queries are now coming into my “Thank you page” ..Thanks for the info.

2 | Article Buster

December 20th, 2009 at 2:53 pm

Avatar

I use “Fast and safe contact form”. It works just fine for me

3 | Greten - WordPress customization

January 8th, 2010 at 6:47 pm

Avatar

Thanks Kieron, I’ve been looking for this tweak for quite sometime. Depending on the page, placing the thank you message on a small popup or on a separate page has advantages and disadvantages.

I will blog on this trick, I’ll link to this page and I have some additional notes.

4 | Kieron Hughes

January 8th, 2010 at 8:52 pm

Avatar

Hi Greten, thanks for the comment, and I’m glad it helped you out! :)

Cheers for stopping by.

5 | Greten - WordPress customization

January 9th, 2010 at 2:37 am

Avatar

Hi Kieron

On the second thought, I just found out that the code location.replace overwrites the history and thus, pressing the back button will not return the user to the contact form page.

I might need to do some research on how to prevent this. I tried replacing location.replace with location.href but it simply did not work.

6 | Kieron Hughes

January 9th, 2010 at 12:04 pm

Avatar

Hi Greten,

I wasn’t aware that it caused that issue, but it’s certainly an interesting one. Instead of finding a solution, maybe it would be better to set the Analytics tracking on the submit button, so you don’t have to have a thank you page?

7 | James Winsoar

April 15th, 2010 at 8:17 pm

Avatar

This tip is no longer working. Have you got any more ideas on how to get it to work?

Comment Form


About

Web Toasite is the social media and SEO blog of Kieron Hughes - a Manchester search marketing consultant with experience running SEO campaigns in a variety of sectors online.

Kieron blogs about SEO industry news, web development and advances in social media. If you wish to contact Kieron you can do so through the online contact form, or connect via the following social networking websites.