Track Contact Form 7 Submissions with Global Site Tag (gtag.js)

In the previous blog post we listed all Contact Form 7 related analytics events that are tracked by the Contact Form 7 Controls plugin and automatically passed to Google Analytics and Matomo (formerly Piwik).

The latest version 0.6.2 of the Contact Form 7 Controls plugin now supports the latest Google Analytics tracking code called “Global Site Tag” or gtag.js which usually look like this:

<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'GA_TRACKING_ID');
</script>

It will automatically send custom tracking events whenever a form submission is submitted, sent, failed to send or is considered spam.

Leave a Reply