• 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(‘https://example.com/your-link’)

    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)
  • 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.

    @partynoparty the reason of the page reload is the non-ajax fallback.

    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.