Contact Form 7 Google Analytics

Description

Adds Google Analytics Event Tracking to all Contact Form 7 forms sitewide, using “Contact Form” as the Event Category, the Contact Form 7 event as the Event Action, and the form name as the Event Label.

Supports the most popular Google Analytics plugins, including the following:

Installation

  1. Install and activate the plugin
  2. Enjoy!

FAQ

Installation Instructions
  1. Install and activate the plugin
  2. Enjoy!
What about GDPR (General Data Protection Regulation)?

This plugin does not collect or send any personal information or form submissions to Google Analytics. The only form-related information sent is the name of the form and the submission result (invalid, spam, mail sent, mail failed, and sent).

Google Analytics does collect more information including, but not limited to, the following:

  • Page name, URL, and language
  • Screen and window size
  • The user’s IP address

For more information, refer to Google’s compliance information.

Please also note that Contact Form 7 and other plugins may collect, process, or store user data.

Where will events show up?

Check your statistics in Google Analytics under Behavior > Events or under Real-Time > Events.

What events will be shown?
  • Invalid – Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because there are fields with invalid input.
  • Spam – Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because a possible spam activity has been detected.
  • Mail Sent – Fires when an Ajax form submission has completed successfully, and mail has been sent.
  • Mail Failed – Fires when an Ajax form submission has completed successfully, but it has failed in sending mail.
  • Sent – Fires when an Ajax form submission has completed successfully, regardless of other incidents. (This is the old plugin behavior.)

Note: you will begin seeing duplicate events in Google Analytics for each form submission: “Sent” plus one of the other four, depending on what happened on submission.

How do I set a goal in Google Analytics?
  1. Click on “Admin” in your Google Analytics account menubar
  2. In the right-most column (“View”), click on “Goals”
  3. Click on the “+ New Goal” button
  4. Set the Goal description
    1. Enter a name for the goal (I suggest “Contact Forms”)
    2. Choose the “Event” radio button and click “Continue”
  5. Set the Goal details
    1. Set “Category Equals to Contact Form”
    2. Set “Action Equals to ” and enter the event you wish to track (see above for a list of events)
    3. Optionally add a label if you want to define a goal for one specific form
    4. Click the “Save” button
How do I use this with Google Tag Manager (gtm.js)?
  1. In your Google Tag Manager workspace, add a new Trigger.
    1. Choose trigger type: “Other/Custom Event”
    2. Set “Event name” to “Contact Form 7”
    3. Set “This trigger fires on” to “Some Custom Events”
    4. Set the dropdowns to “Event contains Contact Form 7”
    5. Save the trigger
  2. In your Google Tag Manager workspace, add a new Tag.
    1. Choose tag type: “Universal Analytics”
    2. Change “Track Type” to “Event”
    3. Set “Category” to “Contact Form 7”
    4. Set “Label” to “{{Event}}”
    5. Click in the “Triggering” box and choose the trigger you set up above.
  3. Save and publish your changes.

Reviews

Great addition to CF7

Why did CF7 remove this much needed feature anyways and required a piece of code in functions.php? This plugin is much more user friendly. It rocks! And great support as well 🙂

Wow! So simple and it works!

I’ve been struggling with another plugin that just wouldn’t track my form submissions. Found this plugin and figured I give it a try. I was a little hesitant that there were no settings to configure but that is the beauty of it. As long as Google Analytics is set up on the site it just does the job.
Tested it on two different forms and GA immediately picked up the submissions. Sends all the info needed to create goals and reporting. It does send two actions (ie. Sent, Mail Sent) but it’s easy enough to filter those out.

Working fine

The plugin dispatch custom events for CF7 forms, working perfectly.

But would be nice to customize the events.

Read all 7 reviews

Contributors & Developers

“Contact Form 7 Google Analytics” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.7.5

  • Update readme with goal tracking instructions

1.7.4

  • Update readme with GDPR notes

1.7.3

1.7.2

  • Fix error with undefined constant

1.7.1

  • Fix error with admin notice on PHP < 5.0

1.7.0

1.6.1

  • Add support for PHP < 5.3

1.6.0

  • Add support for Google Tag Manager

1.5.0

  • Add support for sending the Contact Form 7 form name instead of just the form ID

1.4.1

  • Update suppoprt for gtag.js custom events

1.4.0

  • Add support for the Global Site Tag (gtag.js)

1.3.0

  • Update to use new DOM events in Contact Form 7 v4.8

1.2.2

  • Fix JS issue if ga is undefined

1.2.1

  • Fix PHP undefined index issue

1.2

  • Fix issue where any manually-specified items were being deleted

1.1

  • Add support for Google Analytics by Yoast

1.0

  • First stable version