title: Fire Facebook pixel event on Woocommerce button click
body: <p>I would like to fire a FB pixel AddToCart Event after a user clicked a Woocommerce button. I could use a plugin that works perfectly fine. But I would rather not use a plugin for such a "simple" task. The standard tracking code is implemented and working.</p>
  
  <p>I then used the recommended FB code snippet from the helper tool, but it does not fire:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  document.getElementById('ToCartButton').addEventListener('click', function() {
    fbq('track', 'AddToCart', {
      value: 12,
      currency: 'EUR',
      content_type: 'Produkt',
    });
  }, false);
  
  &lt;button id="ToCartButton"...
  </code></pre>
  
  <p>Using onclick, on the other hand, works:</p>
  
  <pre><code>&lt;script&gt;
  function myFunction() {
    fbq('track', 'AddToCart', {
      value: 12,
      currency: 'EUR',
      content_type: 'Produkt',
    });
  }
  &lt;/script&gt;
  
  &lt;button onclick="myFunction()"...
  </code></pre>
  
  <p>Any ideas? Thanks!</p>