Update: Google Adwords conversion code and Contact Form 7
Last year I wrote a quick guide to add a Google Adwords Conversion code to Contact Form 7, without redirecting to a ‘Thank You’ page. The method I outlined back then doesn’t work anymore, so high time to write up an updated version!
Option 1: Google Analytics (recommended)
First off: if you are using Google Analytics (which you probably are), then by far the easiest and best way of measuring your conversions is by tracking them in Google Analytics, and link the Analytics Goal to Adwords. That way you also have better data in Google Analytics!
The below steps assume you already have Google Analytics installed, using the Universal Analytics snippet and that your Adwords and Google Analytics account are already linked!
1. Edit your Contact Form 7, and go to the Additional Settings tab.
2. Add the following line:
on_sent_ok: "ga('send', 'event', 'Contact Form', 'submit');"
And save the form.
3. Log into Google Analytics, and navigate to your property > Admin > View > Goals, and click the “+ New Goal” button
4. Select the “Contact us” template
5. Select “Event” as the trigger:
6. Set the Event Category to “Contact Form” and the action to “submit”
7. Save the Goal and move on to Adwords! In Adwords go to Tools > Conversions in the main menu
8. In the sidebar, select “Google Analytics”. You should see the Goal you just created select it and press import to continue.
If you do not see your Goal yet – refresh the page in 5 minutes or so. This step sometimes takes some time.
9. Set the final settings for your conversion to finish!
Option 2: Google Adwords Conversion code
If you really need to get the Google Adwords Conversion code to be triggered by Contact Form 7, this is how to do it:
1. In your Adwords console, go to Tools > Conversions in the main menu
2. Create a new conversion (or edit an existing one, if you did this already!)
3. Select ‘Website’ conversion and give it a name and set the options
4. Go to the next step and scroll down to “Install your tag”. There, pick the “Click” option and copy the code that appears.
5. Edit the CF7 form you want to track conversions for and paste the code from the previous step at the end of your form
6. Finally, go to the “Additional Settings” and add the following line:
on_sent_ok: "typeof goog_report_conversion === 'function' && goog_report_conversion();"
(If you are already tracking Google Analytics through these settings, you can use the line below. However, you should really use option 1 above!)
on_sent_ok: "typeof ga === 'function' && ga('send', 'event', 'Contact Form', 'submit'); typeof goog_report_conversion === 'function' && goog_report_conversion();"