Viewing 4 replies - 1 through 4 (of 4 total)
  • I’ll need to update it ASAP.

    Thread Starter pako69

    (@pako69)

    I did it because I need it quickly…

    <script type="text/javascript">
    (function($) {
     $(document).ready(function() {
        $('form').find(':input').blur(function() {
          if (this.value === this.defaultValue) {
            var inputAction = 'skipped';
          } else {
            var inputAction = this.value ? 'completed' : 'skipped';
          }
    //      console.log('Form Abandonment Tracking - Detected: ' + (this.form.id || 'form-without-id') + ' Label: ' + this.name + ' Action: ' + inputAction);
    
    					// G.A. Universal
    				   if (typeof ga !== 'undefined') {
                        ga('send', 'event', (this.form.id || 'form-without-id'), inputAction, $(this).attr('name'));
                        console.log('Form Abandonment Tracking - GA Universal in use, sent: ' + (this.form.id || 'form-without-id') + ' Label: ' + this.name + ' Action: ' + inputAction);
                     }
    
    				 // G.A. Universal compatible Google Analytics by Yoast plugin
                    if (typeof __gaTracker !== 'undefined') {
                        __gaTracker('send', 'event', (this.form.id || 'form-without-id'), inputAction, $(this).attr('name'));
                        console.log('Form Abandonment Tracking - GA Universal in use, sent: ' + (this.form.id || 'form-without-id') + ' Label: ' + this.name + ' Action: ' + inputAction);
                     }
    
                    //check if _gaq is set too
                    if (typeof _gaq !== 'undefined') {
                        _gaq.push(['_trackEvent', (this.form.id || 'form-without-id'), inputAction, $(this).attr('name')]);
                        console.log('Form Abandonment Tracking - Google Analytics in use, sent: ' + (this.form.id || 'form-without-id') + ' Label: ' + this.name + ' Action: ' + inputAction);
                    }
      });
      $('form').find(':input').click(function() {
        if(this.type && this.type.toLowerCase() === 'submit') {
          inputAction = 'submitted';
    //          console.log('Form Abandonment Tracking - Submit clicked: ' + (this.form.id || 'form-without-id') + ' Label: ' + this.name + ' Action: ' + inputAction);
    
    				  // G.A. Universal
                    if (typeof ga !== 'undefined') {
                        ga('send', 'event', (this.form.id || 'form-without-id'), inputAction, $(this).attr('name'));
                        console.log('Form Abandonment Tracking - GA Universal in use, sent: ' + (this.form.id || 'form-without-id') + ' Label: ' + this.name + ' Action: ' + inputAction);
                     }
    
    				  // G.A. Universal compatible Google Analytics by Yoast plugin
                    if (typeof __gaTracker !== 'undefined') {
                        __gaTracker('send', 'event', (this.form.id || 'form-without-id'), inputAction, $(this).attr('name'));
                        console.log('Form Abandonment Tracking - GA Universal in use, sent: ' + (this.form.id || 'form-without-id') + ' Label: ' + this.name + ' Action: ' + inputAction);
                     }
    
                    //check if _gaq is set too
                    if (typeof _gaq !== 'undefined') {
                        _gaq.push(['_trackEvent', (this.form.id || 'form-without-id'), inputAction, $(this).attr('name')]);
                        console.log('Form Abandonment Tracking - Google Analytics in use, sent: ' + (this.form.id || 'form-without-id') + ' Label: ' + this.name + ' Action: ' + inputAction);
                    }
        }
     });
     });
    })(jQuery);
    </script>

    Thanks for that, I’ll get it updated as soon as I can.

    I pushed out an update that should address this and fix the issue while maintaining backwards compatibility as well, very similar to your code. Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘No compatible with Google Analytics by Yoast plugin’ is closed to new replies.