Contact Form 7 and Google Conversion Tracking

The process for getting the worlds most popular Analytics kit (Google Analytics) to play nicely with the World’s most popular WordPress email plugin (Contact Form 7)has changed.

Here’s what you need to do (assuming you are not yet using Google’s tag Manager) to get Analytics to record a hit when your form’s submit button is pressed.

  1. Log in to Google Analytics
  2. Click on the Admin cog
  3. Choose your Account/Property/View
  4. Click on ‘Goals’ for that View
  5. Click the red ‘Add Goal’ button.
  6. Choose an ‘event’ based goal. Ensure you have a created a Category and set action to submitconversion
  7. Now go over to your wordpress site and set up a Contact Form 7 contact form in the usual way
  8. Finally add the following Javascript to the header of your website, remembering to swap out the category for the category you chose earlier<script>
    document.addEventListener( ‘wpcf7mailsent’, function( event ) {
    ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’);
    }, false );
    </script>

 

  1. Fill out the form for a test and check that analytics has picked it up.  You can then import this into adwords too and record ROI.