Contact Form 7 is a popular contact form plugin used on WordPress. Many local businesses often turn to Contact Form 7 because of its robust and simplistic features, making it the ideal plugin for WordPress websites of all trades.

We’ve often been asked by our clients who run Google AdWords to implement Google AdWords conversion tracking. Conversion tracking allows business owners to measure the success of their campaign by tracking the number of successful leads which come through. It’s interesting to know that most WordPress contact forms actually don’t offer this as a default setting.

Many small hacks and plugins often don’t work in fixing this problem. In this post, I’ll explain and thoroughly go through the steps needed to successfully implement Google AdWords conversion tracking with Contact Form 7.

1. Google Adwords Conversion Tracking Code

Login to your Google AdWords campaign and have your conversion tracking code on standby. Your tracking code which should look something like this:

<!– Google Code for Conversion Page –>
<script type=”text/javascript”>
/* <![CDATA[ */
var google_conversion_id = XXXXXXXXX;
var google_conversion_language = “en”;
var google_conversion_format = “3”;
var google_conversion_color = “ffffff”;
var google_conversion_label = “XXXXXXXXXXXXXXXXXXXX”;
var google_remarketing_only = false;
/* ]]> */
<script type=”text/javascript” src=”//”>
<div style=”display:inline;”>
<img height=”1″ width=”1″ style=”border-style:none;” alt=”” src=”//”/>

2. Create “Thank You” Page

Create a thank you page you’d like your prospects to be redirected to after they’ve successfully sent their enquiry. The thank you page will be where your conversion tracking code will be located.

Fill the page with a simple and polite thank you message, acknowledging you’ve received their enquiry. For your convenience I’ve included a generic message which you can simply copy and paste.

Thank you for contacting us. We’ve received your enquiry and one of our friendly staff members will be in touch with you shortly.

3. Install Smart Google Analytics Code Plugin

On the left hand side of the WordPress admin interface, install and activate Smart Google Analytics Code. Click onto the plugin settings and scroll towards the bottom of the page where you will find the conversion code settings. Paste in your Google AdWords conversion code into the right-hand box and select the thank you page you previously created. Conversion name can be anything you’d like.

Once complete, hit “Save AdWords”.

AdWords Conversion Code Settings

4. Add Function Command To Functions.php

Contact Form 7 by default uses JavaScript/AJAX to display a thank you message upon submitting an enquiry. We’re going to redirect the prospect to the thank you page once they’ve hit submit. By doing so, they will land on the tracking page where our conversion code will pick the lead.

To do this, insert the following code into your theme’s functions.php. To locate the file, navigate your way to Appearance > Editor > Theme Functions (functions.php). Paste in the code below.

add_action(‘wpcf7_mail_sent’, ‘ip_wpcf7_mail_sent’);
function ip_wpcf7_mail_sent($wpcf7)
$on_sent_ok = $wpcf7 >additional_setting(‘ip_on_sent_ok’, false);

if (is_array($on_sent_ok) && count($on_sent_ok) > 0)

5. Add Redirect Command To Form Settings

Make your way to your chosen contact form. Scroll down towards the bottom where you will find the option Additional Settings. Paste in the following code:


Edit the above URL to your own. Credits go to maryisead.

6. Disable CF7 JavaScript

Our aim now is to disable JavaScript, allowing the form to redirect to our thank you page without any issues. Navigate your way to Plugins > Editor and select Contact Form 7 from the drop-down box.

Find the following:

define( ‘WPCF7_LOAD_JS’, true );

And replace it with:

define( ‘WPCF7_LOAD_JS’, false );

You’ll then have successfully disabled the plugin from using JavaScript. Once complete, test your form to check whether it successfully functions how you intended. Provide at least a minimum of 24 hours for AdWords to start tracking conversions. You’re done!

Daniel Law

Daniel Law is the Manager Director at Big Vision Marketing, an SEO agency based in Sydney. With over 10 years experience in digital marketing, Daniel has grown a burning passion to helping his clients achieve their business goals via leveraging innovative digital strategies. Follow Daniel on social media at @daniellawsydney, +DanielLaw and Facebook.

Why Us?

We believe that search engine optimisation (SEO) is one of the most powerful online marketing strategies available to your business. Let us help you grow your business online by using innovative SEO strategies proven to generate your business results. Find out more about our SEO services.

We'd love to talk to you about your website's SEO marketing!

Don’t wait around while your competitors are doing everything they can to dominate YOUR industry. Contact us today and receive a FREE competitor and website SEO audit.

Take the first step in the right direction and start your SEO journey with us today!

  • Contact Form
  • Contact Form
  • Contact Form

Request My Complimentary Audit

*Your privacy is important to us. Your details will remain confidential at all times.

Keep up with the latest

Enter your email and keep up to date with latest industry changes