Support » Plugin: Simple Basic Contact Form » How to track contact form submission as Google Analytics Goal?

  • Resolved YoHoJo

    (@yohojo)


    Hello,

    Wondering how I can go about tracking successful form submissions as a Google Analytics goal?

    I have the GA tracking code on my site. With my previous solution I’d run ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’); on successful form completion.

    I tried putting:
    <script>
    ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’);
    </script>

    into the “Success Message” or “After Results” field in the settings, but upon saving, the <script> tags seem to be removed.

    Another way I’ve seen it done is with an event listener.
    <script>
    document.addEventListener( ‘wpcf7mailsent’, function( event ) {
    ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’);
    }, false );
    </script>

    Wondering how I can accomplish this.

    Great Plugin,
    Thank you

    • This topic was modified 2 years, 1 month ago by  YoHoJo.
    • This topic was modified 2 years, 1 month ago by  YoHoJo.
Viewing 1 replies (of 1 total)
  • Hi YoHoJo,

    Honestly I’m not the best person to ask specific GA questions. I would post on the GA forum would probably be the best place to get answers.

Viewing 1 replies (of 1 total)
  • The topic ‘How to track contact form submission as Google Analytics Goal?’ is closed to new replies.