title: How to implement a facebook pixel in Angular?
body: <p>I need to implement a facebook pixel in an angular proyect. I have the pixel in my <code>index.html</code> from <code>src/index.html</code></p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
    &lt;head&gt;
    .....
    &lt;/head&gt;
  
  &lt;body&gt;
    &lt;app-root&gt;&lt;/app-root&gt;
    &lt;!-- Facebook Pixel Code --&gt;
    &lt;script&gt;
      !function(f,b,e,v,n,t,s)
      {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
      n.callMethod.apply(n,arguments):n.queue.push(arguments)};
      if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
      n.queue=[];t=b.createElement(e);t.async=!0;
      t.src=v;s=b.getElementsByTagName(e)[0];
      s.parentNode.insertBefore(t,s)}(window, document,'script',
      'https://connect.facebook.net/en_US/fbevents.js');
      fbq('init', 'XXXXXXXXXXXXX');
      fbq('track', 'PageView');
    &lt;/script&gt;
    &lt;noscript&gt;&lt;img height="1" width="1" style="display:none"
    src="https://www.facebook.com/tr?id=XXXXXXXXXXXXX&amp;ev=PageView&amp;noscript=1"
    /&gt;&lt;/noscript&gt;
    &lt;!-- End Facebook Pixel Code --&gt;
    &lt;script&gt;
    &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>That's how it was "implemented" but it doesn't work, at least is what the facebook panel says. </p>
  
  <p>What's is the right way to do this in a SPA made with Angular?</p>