title: How to post to Google Measurement protocol using Python?
body: <p><a href="https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide" rel="nofollow">Measurement protocol guide</a> </p>
  
  <p>I need an example of how a POST would look using Python.</p>
  
  <p>Something like this, but working.</p>
  
  <pre><code>import httplib, urllib
  conn = httplib.HTTPConnection("www.google-analytics.com")
  conn.request("POST", "v=1&amp;tid=UA-XXXXXX-Y&amp;cid=666&amp;t=event&amp;ec=game&amp;ea=start&amp;ev=0")
  response = conn.getresponse()
  print response.status, response.reason
  data = response.read()
  conn.close()
  </code></pre>