UNPKG

1.48 kBMarkdownView Raw
1<img
2 src="../../../assets/svg/facebook.svg"
3 alt="Facebook Pixel logo"
4 height="100px"
5 width="200px" />
6
7# Facebook Pixel
8
9__homepage__: [www.facebook.com/business/a/facebook-pixel](https://www.facebook.com/business/a/facebook-pixel)
10__docs__: [developers.facebook.com/docs/facebook-pixel](https://developers.facebook.com/docs/facebook-pixel)
11__import__: `import { Angulartics2Facebook } from 'angulartics2/facebook';`
12
13## Setup
14
151. Add tracking code [provided by Facebook](https://www.facebook.com/events_manager/)
16```html
17 <!-- Facebook Pixel Code -->
18 <script>
19 !function(f,b,e,v,n,t,s)
20 {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
21 n.callMethod.apply(n,arguments):n.queue.push(arguments)};
22 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
23 n.queue=[];t=b.createElement(e);t.async=!0;
24 t.src=v;s=b.getElementsByTagName(e)[0];
25 s.parentNode.insertBefore(t,s)}(window, document,'script',
26 'https://connect.facebook.net/en_US/fbevents.js');
27 fbq('init', 'XXXXXXXXXXXXXXX');
28 fbq('track', 'PageView');
29 </script>
30 <noscript><img height="1" width="1" style="display:none"
31 src="https://www.facebook.com/tr?id=XXXXXXXXXXXXXXX&ev=PageView&noscript=1"
32 /></noscript>
33 <!-- End Facebook Pixel Code -->
34```
352. Do **not** remove the pageview tracking (as you would to for Google Analytics)
363. [Setup Angulartics](https://github.com/angulartics/angulartics2/tree/next#installation) using `Angulartics2Facebook`