Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

106
Views
¿Cómo puedo habilitar el seguimiento de Google Analytics en el Formulario de contacto 7 cuando tengo uno o más botones de verificación marcados?

Mi formulario de contacto tiene este formato:

 <div class="col-md-12">[text* text-813 placeholder "Name:"]</div> <div class="col-md-12">[email* email-597 placeholder "EMail:"]</div> <div class="col-md-12">[tel* tel-345 placeholder "Tel:"]</div> </p> [checkbox checkbox-770 id:Personal use_label_element "Personal"] [checkbox checkbox-771 id:Buisness use_label_element "My Buisness"] </div> [textarea textarea-552 placeholder "Ask about anything!"]</div> [submit "Submit"]</div>

Y quiero habilitar el seguimiento de GA para sus respectivos campos cuando una o más de las entradas de la casilla de verificación están marcadas.

Aquí está el código que he probado hasta ahora:

 document.addEventListener( 'wpcf7submit', function( event ) { jQuery(function($) { if ($('input').is(':checked')) { dataLayer.push({ 'event': 'Form_Submission' 'Interest': 'Business' }); } if ($('input').is(':checked')) { dataLayer.push({ 'event': 'Form_Submission' 'Interest': 'Personal' }); } }); }, false );

Pero no funciona, no obtengo errores como resultado. ¿Alguien puede ayudarme a resolver esto? Gracias de antemano.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Debe usar event.detail.inputs que pasa wpcf7submit

 document.addEventListener( 'wpcf7submit', function( event ) { let inputs = event.detail.inputs; for ( let i = 0; i < inputs.length; i++ ) { if ( 'checkbox-770[]' == inputs[i].name ) { dataLayer.push({ 'event': 'Form_Submission', 'Interest': 'Personal' }); } else if ('checkbox-771[]' === inputs[i].name ){ dataLayer.push({ 'event': 'Form_Submission', 'Interest': 'Business' }); } } }, false );
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!