title: Ecommerce Tracking via Google Tag Manager
body: <p>I have a question regarding ecommerce tracking.</p>
  
  <p>I wanted to track the products added from cart/removed from cart.</p>
  
  <p>How can I track if a user adds multiple products to cart,or how can we add the details of a single product when we cannot decide which product user will click. And if a user can take different quantities, How can we assign quantities in a macro?</p>
  
  <p>I found a JavaScript which goes like this:</p>
  
  <pre><code>function() {
      var ecommerceData = {
          'event': 'addToCart',
          'ecommerce': {
              'currencyCode': 'USD',
              'add': {
                  'products': [{
                      'id': '122',
                      'name': 'Shirt',
                      'quantity': '2'
                  }]
              }
          }
      };
      return ecommerceData;
  }
  </code></pre>