How to Add AdWords Conversion Tracking to Contact Form 7 in WordPress

Google Adwords Logo

Well, we never thought that adding an AdWords conversion tracking code to a Contact Form 7 form in WordPress would be the ridiculous polava it turned out to be.

To cut a long story short, WordPress gets funny about scripts on WordPress pages, and the AdWords code unfortunately falls into such a category.

You also need to make sure the code gets in-between the <body> </body> tags, otherwise it won’t register with AdWords.

To save you time and grey hair, here’s the quick fix:

  1. Create a thank you page (this should be a normal page from the Pages -> Add New menu item), and set the permalink to “thank-you” (or something similar, which will be used below).
  2. Create your Contact Form 7 form, and in the “Additional Settings” box at the very bottom, put: on_sent_ok: “location.replace(‘http://YourDomain.com/thank-you/’);”
  3. Go to Plugins -> Add New.
  4. Search for and install the Smart Google Analytics Code plugin.  Activate plugin.
  5. Click the Smart Google Code option from the main side menu on the left.
  6. Add your AdWords tracking code to the AdWords Conversion Code Settings box at the bottom, pick your newly created Thank You page from the drop down list and complete the Caption box with something meaningful.
  7. Save Changes, run a test form submission, check the thank you page source code (right click -> view source code) to check the AdWords conversion tracking code is showing in-between the <body> tags.

Note: It can take up to 48 hours for customers who click your AdWords advert and then “convert”, to appear in your AdWords statistics.

Troubleshooting

  • If your form does not send when you push the send button, you might be experiencing an “Uncaught SyntaxError: Unexpected token ILLEGAL” error when your form is submitted (error will not show on the page, and will only show as an error when you open the Inspect Element or Console part of Chrome).  To resolve this, please make sure any code you copy from this article, (or from the Google AdWords conversion code section) is pasted into a plain text editor first to remove any formatting (use Notepad for PC’s, or TextEdit in plain text mode for Mac’s).  This seems to be a problem with Chrome browsers in particular.

Sara Thornton

Sara is a Jack (or Jill) of many trades. A web designer and developer, an ethical SEO implementer, an AdWords advocate, as well as being our in house user-guide creator and trainer. In her spare time she loves a bendy/stretchy yoga session, and feels most happy when she's near the ocean (ideally with a ridiculously absorbing book).

Comments (20)

Leave a Reply

Your email address will not be published. Required fields are marked *

Connect With Us

Contact Us

4 Redwood Lodge, Reigate
Surrey, RH2 0LU, UK

WebHolism Limited © 2006 - 2021
Registered in England and Wales, Registered Number 7290215
ICO Registered: ZB042427