title: How would I put multiple Facebook tracking pixels on one web page?
body: <p>We are trying to use Facebook's Ad tracking pixels to track ads.
  we looked at Facebook's documentation and that led me no where.</p>
  
  <p>I need to know how to trigger multiple Facebook pixels on one page because we have multiple ads running.</p>
  
  <p>I took the code that it gave me per pixel and placed it on the page and then we have a Cart page in which I fire or add the 'Purchase' event.  But since I have the script 3 times it seems to fire 3 times. I want it to fire once per pixel.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>&lt;!-- Facebook Pixel Code - Ad 1--&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','//connect.facebook.net/en_US/fbevents.js');
  
   fbq('init', 'xxxxxxxxxxxxx12');
   fbq('track', "PageView");
   // Purchase
   // Track purchases or checkout flow completions (ex. landing on "Thank You" or confirmation page)
   fbq('track', 'Purchase', {value: '1.00', currency: 'USD'});
   &lt;/script&gt;
   &lt;noscript&gt;&lt;img height="1" width="1" style="display:none"
   src="https://www.facebook.com/tr?id=xxxxxxxxxxxxx12&amp;ev=PageView&amp;noscript=1"
    /&gt;&lt;/noscript&gt;
  &lt;!-- End Facebook Pixel Code --&gt;
  
   &lt;!-- Facebook Pixel Code - Ad 2--&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','//connect.facebook.net/en_US/fbevents.js');
  
   fbq('init', 'xxxxxxxxxxxxx34');
   fbq('track', "PageView");
   // Purchase
   // Track purchases or checkout flow completions (ex. landing on "Thank You" or confirmation page)
   fbq('track', 'Purchase', {value: '1.00', currency: 'USD'});
  
   &lt;/script&gt;
   &lt;noscript&gt;&lt;img height="1" width="1" style="display:none"
   src="https://www.facebook.com/tr?id=xxxxxxxxxxxxx34&amp;ev=PageView&amp;noscript=1"
    /&gt;&lt;/noscript&gt;
  &lt;!-- End Facebook Pixel Code --&gt;
  
   &lt;!-- Facebook Pixel Code - Ad 2--&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','//connect.facebook.net/en_US/fbevents.js');
  
   fbq('init', 'xxxxxxxxxxxxx56');
   fbq('track', "PageView");
   // Purchase
   // Track purchases or checkout flow completions (ex. landing on "Thank You" or confirmation page)
   fbq('track', 'Purchase', {value: '1.00', currency: 'USD'});
   &lt;/script&gt;
   &lt;noscript&gt;&lt;img height="1" width="1" style="display:none"
   src="https://www.facebook.com/tr?id=xxxxxxxxxxxxx56&amp;ev=PageView&amp;noscript=1"
    /&gt;&lt;/noscript&gt;
  &lt;!-- End Facebook Pixel Code --&gt;
  </code></pre>
  
  <p>Is this the way to do it?  Or do I need to do something different so that the Purchase event does not get fired 4 times. I am using the FB Pixel Helper plugin for Chrome to make sure all pixels are firing, but I am getting an error that they are firing multiple times.</p>
  
  <p><strong>Would I do something like this?</strong></p>
  
  <pre><code> &lt;!-- Facebook Pixel Code - ALL ADS--&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','//connect.facebook.net/en_US/fbevents.js');
  
   fbq('init', 'xxxxxxxxxxxxx12');
   fbq('init', 'xxxxxxxxxxxxx34');
   fbq('init', 'xxxxxxxxxxxxx56');
   fbq('track', "PageView");
   // Purchase
   // Track purchases or checkout flow completions (ex. landing on "Thank You" or confirmation page)
   fbq('track', 'Purchase', {value: '1.00', currency: 'USD'});
   &lt;/script&gt;
   &lt;noscript&gt;&lt;img height="1" width="1" style="display:none"
   src="https://www.facebook.com/tr?id=xxxxxxxxxxxxx12&amp;ev=PageView&amp;noscript=1"
    /&gt;&lt;/noscript&gt;
  &lt;!-- End Facebook Pixel Code --&gt;
  </code></pre>