title: Google Measurement protocol returns GIF89a�����,D;
body: <p>I'm saving impressions using the Google Measurement protocol API. It works fine but although i'm not echoing anything it returns GIF89a�����,D; which is visible on the page. Any idea how I can hide this?</p>
  
  <p>I'm sending the data using a HTTP post request. </p>
  
  <pre><code>$url = 'http://www.google-analytics.com/collect';
  $fields_string = '';
  $fields = array(
      'v' =&gt; 1,
      'tid' =&gt; 'UA-xxxxxxx-xx',
      'cid' =&gt; xxx,
      't' =&gt; 'event',
      'ec' =&gt; 'category',
      'ea' =&gt; 'impression',
      'el' =&gt; 'label'
  );
  
  foreach($fields as $key=&gt;$value) { $fields_string .= $key.'='.$value.'&amp;'; }
  rtrim($fields_string, '&amp;');
  
  $ch = curl_init();
  
  curl_setopt($ch,CURLOPT_URL, $url);
  curl_setopt($ch,CURLOPT_POST, count($fields));
  curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
  
  $result = curl_exec($ch);
  curl_close($ch);
  </code></pre>