title: Google Analytics - track multiple events in single HTTP request
body: <p>I need to track how many times the item is present in search results (in web application). I.e. user search something and get first 20 items - 1 visit for each of 20th items is tracked.
  On another page user can see statistic for item - how many times it was shown in search results.</p>
  
  <p>I consider usage of <a href="https://developers.google.com/analytics/devguides/collection/analyticsjs/events" rel="nofollow noreferrer">Google Analytics Event Tracking</a> for that task. E.g. from Javascript:</p>
  
  <pre><code>ga('send', 'event', {
      eventCategory: 'item-category',
      eventAction: 'search',
      eventLabel: 'item-id',
  });
  </code></pre>
  
  <p>But unfortunately Google Analytics API allows to register only 1 event per 1 HTTP request. It means that for every search 20+ HTTP requests will be send. That's pretty ineffective for our requirements.</p>
  
  <p>I looked for workarounds:</p>
  
  <ol>
  <li><a href="https://developers.google.com/analytics/devguides/collection/protocol/v1/reference" rel="nofollow noreferrer">Measurement protocol</a> allows to send direct HTTP requests, but both GET and POST versions of <a href="http://www.google-analytics.com/collect" rel="nofollow noreferrer">http://www.google-analytics.com/collect</a> registers only single event per request.</li>
  <li><a href="https://developers.google.com/gdata/docs/batch?csw=1" rel="nofollow noreferrer">Batch Processing in Google Data</a> might help, but GData <a href="https://developers.google.com/gdata/docs/developers-guide" rel="nofollow noreferrer">looks obsolete</a> and I am not sure if it supports Google Analytics Events data. It looks quite heavyweight for experiments.</li>
  <li><a href="https://developers.google.com/analytics/devguides/config/mgmt/v3/" rel="nofollow noreferrer">Management API</a> and <a href="https://developers.google.com/analytics/devguides/reporting/core/v3/" rel="nofollow noreferrer">Reporting API</a> does not support uploading of events data.</li>
  <li>It is not possible with ga.js (previous version of Google Analytics Tracking): <a href="https://stackoverflow.com/questions/6667209/post-multiple-events-within-one-httprequest-to-google-analytics">Post Multiple Events within One HttpRequest to Google Analytics</a></li>
  </ol>
  
  <p>Is it possible to register multiple Google Analytics events per 1 HTTP request?</p>