UNPKG

ngx-analytics

Version:

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

49 lines (44 loc) 1.77 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('ngx-analytics')) : typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'ngx-analytics'], factory) : (factory((global['ngx-analytics'] = global['ngx-analytics'] || {}, global['ngx-analytics'].facebook = {}),global.ng.core,global['ngx-analytics'])); }(this, (function (exports,core,ngxAnalytics) { 'use strict'; 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: core.Injectable }, ]; NgxAnalyticsFacebook.ctorParameters = function () { return [ { type: ngxAnalytics.NgxAnalytics, }, ]; }; return NgxAnalyticsFacebook; }()); exports.NgxAnalyticsFacebook = NgxAnalyticsFacebook; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=facebook.umd.js.map