Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
Form submit tracking

I'm trying to get Google Ads to track a conversion every time the user submits a form on a wordpress site. The problem is that even though everything is placed correctly I can't track the click even. The global Google tag is placed on the website, as well as the page specific tag and the button tag [Originally: return gtag_report_conversion('https://theurl.com/sub/')] which is where I think the issue lies. I'm utilizing the following code to modify the form's submit button in order to add the onclick event:

add_filter( 'gform_submit_button_3', 'form_submit_button', 10, 2 );
function form_submit_button( $button, $form ) {
    return '<input type="submit" id="gform_submit_button_3" class="gform_button button" value="Enviar" onclick="return gtag_report_conversion(https://theurl.com/sub/); if(window[&quot;gf_submitting_3&quot;]){return false;}  window[&quot;gf_submitting_3&quot;]=true; " onkeypress="if( event.keyCode == 13 ){ if(window[&quot;gf_submitting_3&quot;]){return false;} window[&quot;gf_submitting_3&quot;]=true;  jQuery(&quot;#gform_3&quot;).trigger(&quot;submit&quot;,[true]); }">';
}

As you can see I had to modify the code slightly to remove the apostrophes so it didn't screw up with the function and I think that may have something to do with the issue I'm having.

I also tried to escape part of the html code like this, but that completely disables the function of the button (the page reloads and nothing gets send):

add_filter( 'gform_submit_button_3', 'form_submit_button', 10, 2 );
function form_submit_button( $button, $form ) {
    $theurl = "return gtag_report_conversion('https://theurl.com/join/')";
    return '<input type="submit" id="gform_submit_button_3" class="gform_button button" value="Enviar" onclick="if(window[&quot;gf_submitting_3&quot;]){return false;}  window[&quot;gf_submitting_3&quot;]=true; '. esc_html($theurl) .';" onkeypress="if( event.keyCode == 13 ){ if(window[&quot;gf_submitting_3&quot;]){return false;} window[&quot;gf_submitting_3&quot;]=true;  jQuery(&quot;#gform_3&quot;).trigger(&quot;submit&quot;,[true]); }">';
}

Any clue what I could be doing wrong?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda