AngularJS facebook pixel analytics
-load js
<script src="./angular.js"></script>
<script src="./angular-facebook-pixel.min.js"></script>
-module
angular.module('MyApp', ['ps-facebook-pixel'])
myApp.config(function($pixelProvider) {
$pixelProvider.id = '1234567890'; // required, pixel id
$pixelProvider.currency = 'TWD'; // optional, default is TWD!
$pixelProvider.disablePushState = false; // optional, default is false
$pixelProvider.delayPageView = false; // optional, default is false
})
if you set delayPageView, manual pageview start
myApp.run(function($pixel) {
$pixel.pageView();
})
$pixel.track('AddToCart', {
content_ids: ['1234', '1853', '9386'],
content_type: 'product',
value: 67,
currency: 'TWD'
})
$pixel.purchase(67);
<!--- or --->
$pixel.purchase({
value: 67,
currency: 'TWD'
});