title: Google Tag Manager access datalayer object values
body: <p>I'm trying to access datalayer variables on add to cart event but it does not get tracked on the tag manager admin site </p>
  
  <p>*The event is triggered but the values are not send</p>
  
  <p>Datalayer push:</p>
  
  <pre><code>&lt;script&gt;
    dataLayer.push({
      'event': 'addToCart', 
      'ecommerce': {
        'currencyCode': 'EUR', 
        'add': {
          'products': [
            {
              'name': 'test',
              'id': 'ZZZ232323',
              'price': 33,
              'brand': '',
              'category': 'test',
              'variant': '','quantity': 1
            }
          ]
        }
      }
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>And i'm trying to access the datalayer to get the product name using: </p>
  
  <pre><code>dataLayer.find(x =&gt; x.event == 'addToCart').ecommerce.add.products[dataLayer.find(x =&gt; x.event == 'addToCart').ecommerce.add.products.length - 1].price
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Vgd3n.png" rel="nofollow noreferrer">Image of google tag manager site</a></p>