• Hi there

    I was trying to find a flexible way to add Google Analytics event tracking to my forms so that I can have a goal in Google Analytics for when the form is submitted. My client’s site uses lots of forms, so it’s impractical to track each of them separately.

    For example, you’ll see that the form in the footer of this site (https://www.michaelneill.org/) has no id or name, just the class ‘clearfix’. That doesn’t give much to hook onto without going up the DOM and looking at parent divs.

    Can I recommend two suggestions for your plugin?
    1. Add the ability for a user to add a form ID/name to each form, which will output on the form element, so that forms can be identified individually(like WP Contact Form 7 does).

    2. Add a basic Google Tag Manager support, i.e. send a GTM event when a form is submitted, something like this:

    <script>
    window.dataLayer = window.dataLayer || [];
    dataLayer.push({
      'event' : 'optim.formSubmitted',
      'formID' : 2,
      'formName' : 'Footer' //Whatever user has entered in CMS
    });
    </script>

    This will allow your users to easily track your forms in third party applications (like Analytics, Facebook, etc.)

    • This topic was modified 5 years, 9 months ago by daisyfountain. Reason: Clarification

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Google Tag Manager integration’ is closed to new replies.