( function( $ ) {

  $( document ).on( 'submit_success', function( e ) {

    gtag( 'event', 'Form Submission', {
      'event_category' : 'Leads',
      'event_label' : e.target.name,
    } );
  
  } );

} )( jQuery );

How to use it?

Usually adding functionality to a WordPress site is by creating a plugin.
However you can simply copy the code and paste it in your child theme’s functions.php file at the end of the file, just before ?>.

For JavaScript code you will need to add them to your theme’s main JavaScript file.

Having issues with the code?

If the code doesn’t work or you get an error please let us know in the comments section.
We will do our best to fix it as-soon-as-possible and update the code on this page.

Comments

  1. Baruch Denderowicz

    Don’t work for me..
    here is the error:

    השינויים בקוד PHP שוחזרו בגלל שגיאה בשורה 42 בקובץ wp-content/themes/hello-theme-child-master/functions.php. נא לתקן ולשמור שנית.

    syntax error, unexpected ‘$’, expecting variable (T_VARIABLE)

    Thank you dor

    Reply
    1. Dor Zuberi

      Hi Baruch,
      It look like you might have entered the code incorrectly.

Leave a Reply