xhinvis
xhinvis

Reputation: 211

Google Analytics Event tracking for Goals

I am having an issue in using the Google Goals for my My Event Tracking. I have added Google even tracking code to my web page. However, I cannot check for any conversions in my Google Goals but the event result can be shown in the Google Analytic --> Behavior --> Events Overview.

My Code is below

`     <script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-87810245-1', 'auto');
  ga('send', 'pageview');

</script>
      <script>

$('#contact-form').on('submit', function(event) {
  // Prevent the browser's default form submission action.
  event.preventDefault();

  ga('send', 'event', {
    eventCategory: 'Contact',
    eventAction: 'Information Request',
    eventLabel: 'Contact Form',
    hitCallback: function() {
      $('contact-form').trigger('submit');
    }
  });
});

      </script>`

Code for my Submit Button:

<input type="submit" id="submit" value="Validate and Submit" onclick="ga('send', 'event', 'form', 'submit', 'order sent', 10);"/>

My Google Goals:

enter image description hereenter image description here

Google Analytics Events Overview: enter image description here

Upvotes: 0

Views: 947

Answers (1)

nyuen
nyuen

Reputation: 8907

So you've got two events going on, one for the click of the submit button (to track intent perhaps) and one for the form submission itself. Your goal is configured to expect a value Greater than 10, but your form submission event is not passing a value in. You should either add a value (greater than 10), or remove the value from the goal configuration. Also your screenshot shows likely just the click event (since there's a value of 10 associated with it), but you'd probably be more interested in the actual submissions themselves.

Upvotes: 1

Related Questions