I discovered this while setting up Google Analytics when I recently re-launched my site.
At first I tried the instructions from Contact Form 7.
What it boils down to is editing your form in CF7, clicking the “Additional Settings” tab, and entering this:
_gaq.push(['_trackEvent', 'Contact Form', 'Submit']);
When I tested it, I didn’t get the usual confirmation message. I noticed this in the Chrome Web Developer console:
Uncaught ReferenceError: _gaq is not defined
So why is it undefined? Initially I thought it might be that CF7 is loading before GAbY, but that’s not the case.
By default, Google Analytics by Yoast doesn’t track Administrator and Editor user types. This is why _gaq is not defined. To test it as a user, I use Chrome’s “Incognito mode”. It’s an easy way to open a window where I’m not logged in.
Once I did this the Contact Form 7 form worked correctly.
I’m expecting the event to show up in Google Analytics under Behaviour -> Events. It’s been less than the 24-48 hours so the events are yet to show up in my Analytics account, but I’m pretty confident it’s working correctly now. If not, I’ll update this post.