WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. kcweb
    Member
    Posted 1 year 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:

    https://www.kcwebspecialists.com/contact-us/

    http://wordpress.org/extend/plugins/contact-form-7/

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

  3. Joseph
    Member
    Posted 1 year 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

About this Topic