title: Google Analytics autotrack Ajax not working in a jsf application
body: <p>Google Analytics does not track ajax calls in a JSF web application. so I'm using <a href="https://github.com/googleanalytics/autotrack" rel="nofollow noreferrer">autotrack</a> here is the code:</p>
  
  <pre><code>&lt;script&gt;
          window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
          ga('create', 'UA-********2-1', 'auto');
  
          ga('require', 'cleanUrlTracker');
          ga('require', 'eventTracker');
          ga('require', 'impressionTracker');
          ga('require', 'maxScrollTracker');
          ga('require', 'mediaQueryTracker');
          ga('require', 'outboundFormTracker');
          ga('require', 'outboundLinkTracker');
          ga('require', 'pageVisibilityTracker');
          ga('require', 'urlChangeTracker');
  
          ga('send', 'pageview');
      &lt;/script&gt;
  
      &lt;h:outputScript library="custom" name="autotrack/autotrack.js" p:async="async"/&gt;
      &lt;script async="async" src="https://www.google-analytics.com/analytics.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>So When I click:</p>
  
  <pre><code>&lt;h:commandButton id="nextBtn" value="Next" action="#{testBean.nextQuestion}" &gt;
      &lt;f:ajax execute="@form" render="pass-section title-section" onevent="go_top_and_apply_code_mirror" /&gt;
  &lt;/h:commandButton&gt;
  </code></pre>
  
  <p>and <code>go_top_and_apply_code_mirror</code>calls <code>ga('send', 'pageview')</code>. Except while I'm using the website clicking around, Google Analytics does not register me using the web page.</p>
  
  <p>Chrome Console: shows this error</p>
  
  <pre><code>Failed to load resource: net::ERR_CONNECTION_CLOSED            www.google-analytics.com/collect:1 
  </code></pre>
  
  <p>So what Am I doing wrong?</p>