Contact Form 7
[resolved] Adding EventTracker code to Submit Button (3 posts)

  1. kcweb
    Posted 3 years ago #

    How do I put a custom onClick event on the submit button within Contact Form 7?

    My goal is to be able to track the number of times our form is submitted via Google Analytics. I have the onClick Event Tracking code from Google. We are already calling the Analytics code in our header, so the function knows what to reference.

    The form is submitted using AJAX--hence why I am trying to track the onClick and not just a form submission "thank you" page.

    Here is the page in reference:



  2. Takayuki Miyoshi
    Plugin Author

    Posted 3 years ago #

  3. Joseph
    Posted 3 years ago #

    kcweb, I had the same problem but fixed it with the below

    on_sent_ok: "_gaq.push(['_trackPageview', '/contactBar/thank-you/']);"

    for forms that aren't in the sidebar I use this:

    on_sent_ok: "_gaq.push(['_trackPageview', '/contactPage/thank-you/']);"

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic