title: PHP problems with Google Analytics E-commerce: theiconic/php-ga-measurement-protocol
body: <p>I'm using the theiconic/php-ga-measurement-protocol package and have followed the exact steps as described in the readme, but for reasons I don't quite understand, half of the info does not show up in Google Analytics.</p>
  
  <p>I'm using the following code:</p>
  
  <pre><code>use TheIconic\Tracking\GoogleAnalytics\Analytics;
  
  $trackingID = 'xxxxxxx';
  $order = 'obviously an object';
  $deal = 'object';
  
  $analytics = new Analytics();
  
  // the Client ID just won't do anything
  $analytics-&gt;setProtocolVersion('1')
      -&gt;setClientId($order-&gt;gaClientID)
      -&gt;setTrackingId($trackingID);
  
  // this part works just fine
  $analytics-&gt;setTransactionId($transactionID)
      -&gt;setRevenue($order-&gt;getTotalPrice(false))
      -&gt;setTax($order-&gt;getTaxCost())
      -&gt;sendTransaction();
  
  // here it's as if nothing happens
  // Yes, it does loop over all the orderRules but it does not show up in Google Analytics
  foreach ($order-&gt;getOrderRules() as $orderRule) {
      $analytics-&gt;setTransactionId($transactionID)
          -&gt;setItemName($deal-&gt;name)
          -&gt;setItemCode($order-&gt;dealID)
          -&gt;setItemCategory($deal-&gt;getDealCategoryName())
          -&gt;setItemPrice($orderRule-&gt;getPrice())
          -&gt;sendItem();
  }
  </code></pre>
  
  <p>And I'm saving the ClientID with this JavaScript into a hidden input:</p>
  
  <pre><code>ga.getAll()[0].get('clientId')
  </code></pre>
  
  <p>So my issues are basically:</p>
  
  <ul>
  <li>client ID does not work</li>
  <li>Items do not appear in Google Analytics Ecommerce</li>
  </ul>
  
  <p>Is there anything I am forgetting? I've had several people looking at it, not being able to find out where it's going wrong.</p>