Title: Adding EventTracker code to Submit Button
Last modified: August 20, 2016

---

# Adding EventTracker code to Submit Button

 *  Resolved [kcweb](https://wordpress.org/support/users/kcweb/)
 * (@kcweb)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/adding-eventtracker-code-to-submit-button/)
 * 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/](https://www.kcwebspecialists.com/contact-us/)
 * [http://wordpress.org/extend/plugins/contact-form-7/](http://wordpress.org/extend/plugins/contact-form-7/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/adding-eventtracker-code-to-submit-button/#post-3362816)
 * See [Tracking Form Submissions with Google Analytics](http://contactform7.com/tracking-form-submissions-with-google-analytics/).
 *  [Joseph](https://wordpress.org/support/users/jbojang/)
 * (@jbojang)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/adding-eventtracker-code-to-submit-button/#post-3363083)
 * 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/’]);”

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding EventTracker code to Submit Button’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [Joseph](https://wordpress.org/support/users/jbojang/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/adding-eventtracker-code-to-submit-button/#post-3363083)
 * Status: resolved