UNPKG

ngx-analytics

Version:

Vendor-agnostic web analytics for Angular2 applications, based on angulartics2

42 lines (39 loc) 1.27 kB
import { Injectable } from '@angular/core'; import { NgxAnalytics } from 'ngx-analytics'; var facebookEventList = [ 'ViewContent', 'Search', 'AddToCart', 'AddToWishlist', 'InitiateCheckout', 'AddPaymentInfo', 'Purchase', 'Lead', 'CompleteRegistration', ]; var NgxAnalyticsFacebook = (function () { function NgxAnalyticsFacebook(ngxAnalytics$$1) { var _this = this; this.ngxAnalytics = ngxAnalytics$$1; this.ngxAnalytics.eventTrack.subscribe(function (x) { return _this.eventTrack(x.action, x.properties); }); } NgxAnalyticsFacebook.prototype.eventTrack = function (action, properties) { if (properties === void 0) { properties = {}; } if (typeof fbq === 'undefined') { return; } if (facebookEventList.indexOf(action) === -1) { return fbq('trackCustom', action, properties); } return fbq('track', action, properties); }; NgxAnalyticsFacebook.decorators = [ { type: Injectable }, ]; NgxAnalyticsFacebook.ctorParameters = function () { return [ { type: NgxAnalytics, }, ]; }; return NgxAnalyticsFacebook; }()); export { NgxAnalyticsFacebook }; //# sourceMappingURL=facebook.es2015.js.map