Title: Google Ads &#8211; Tracking Clicks &#8211; Adding code to Submit button
Last modified: April 19, 2021

---

# Google Ads – Tracking Clicks – Adding code to Submit button

 *  [JDHMarketing](https://wordpress.org/support/users/jdhmarketing/)
 * (@jdhmarketing)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/google-ads-tracking-clicks-adding-code-to-submit-button/)
 * Hello,
 * I’m installing a Google Ads conversion tracking code for contact form submits.
   I added the first part of the Google Ads code in the head, now i need to add 
   this to the button:
 *  onclick=”return gtag_report_conversion(‘[http://example.com/your-link&#8217](http://example.com/your-link&#8217);)
 * I don’t know how to access the form button code to add this to it. Also, I noticed
   the button is wrapped in an ‘input’ tag, will this code still work if I do manage
   to find the code for this?

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

 *  [partynoparty](https://wordpress.org/support/users/partynoparty/)
 * (@partynoparty)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/google-ads-tracking-clicks-adding-code-to-submit-button/#post-14568028)
 * I’m trying to do the same thing. I’m not positive that this will work, but this
   is what I just implemented on my site.
 * document.addEventListener( ‘wpcf7mailsent’, function( event ) {
    return gtag_report_conversion(‘/#
   wpcf7-f171-o1’); }, false );
 * In my case, I pulled the url from the action value of the contact form. I don’t
   know if this is the correct way to do, and I won’t know for a few days if this
   is actually working or not. I also noticed that the page reloads when this event
   is triggered, which isn’t ideal. I’d be curious if there were a better way to
   do this.
 *  [Erik](https://wordpress.org/support/users/codekraft/)
 * (@codekraft)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/google-ads-tracking-clicks-adding-code-to-submit-button/#post-14572084)
 * [@partynoparty](https://wordpress.org/support/users/partynoparty/) the reason
   of the page reload is the non-ajax fallback.
 * [https://contactform7.com/why-isnt-my-ajax-contact-form-working-correctly/](https://contactform7.com/why-isnt-my-ajax-contact-form-working-correctly/)

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

The topic ‘Google Ads – Tracking Clicks – Adding 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/)

## Tags

 * [ads](https://wordpress.org/support/topic-tag/ads/)
 * [conversion tracking](https://wordpress.org/support/topic-tag/conversion-tracking/)
 * [gtag](https://wordpress.org/support/topic-tag/gtag/)
 * [tracking](https://wordpress.org/support/topic-tag/tracking/)

 * 2 replies
 * 3 participants
 * Last reply from: [Erik](https://wordpress.org/support/users/codekraft/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/google-ads-tracking-clicks-adding-code-to-submit-button/#post-14572084)
 * Status: not resolved