Overview

How to create advanced conditional goals with Gravity Forms and Logic Hop for personalizing WordPress.

Note: The HTML Content Areas in Gravity Forms are used to determine if the user is eligible or ineligible. You can leave the content areas empty if you’d prefer to not have a message displayed before the user submits the form.

Javascript Code

<script>
  jQuery( document ).ready( function () {
    jQuery( document ).on( 'gform_post_render', function ( event, form_id, current_page ) {

      var submitted = false;

      if ( jQuery( '.eligible' ).is( ':visible' ) ) {

        console.log( 'user-is-eligible' );
        logichop_goal( 'user-is-eligible' );
        submitted = true;
      }

      if ( jQuery( '.ineligible' ).is( ':visible' ) ) {

        console.log( 'user-is-ineligible' );
        logichop_goal_delete( 'user-is-eligible' );
        submitted = true;
      }

      if ( submitted ) {

        console.log( 'submitted' );
        window.location.href = '/member-validator/thank-you';
      }

    } );
  } );
</script>


Reference