title: Set up Facebook pixel to fire on click event
body: <p>I want to set up a pixel to fire when a button is clicked. Facebook offers <a href="https://developers.facebook.com/docs/ads-for-websites/conversion-pixel-code-migration#in-page-events" rel="nofollow">some info here</a> on doing this very thing, but I am a javascript novice and can't figure it out. How does one use the info on that page to alter the code below to fire on a button click? Here is the base code snippet:</p>
  
  <pre><code>&lt;script&gt;(function() {
  var _fbq = window._fbq || (window._fbq = []);
  if (!_fbq.loaded) {
  var fbds = document.createElement('script');
  fbds.async = true;
  fbds.src = '//connect.facebook.net/en_US/fbds.js';
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(fbds, s);
  _fbq.loaded = true;
  }
  })();
  window._fbq = window._fbq || [];
  window._fbq.push(['track', 'MyPixelID', {'value':'0.01','currency':'USD'}]);
  &lt;/script&gt;
  </code></pre>