ngx-analytics
Version:
Vendor-agnostic web analytics for Angular2 applications, based on angulartics2
49 lines (44 loc) • 2.04 kB
JavaScript
(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'].hubspot = {}),global.ng.core,global['ngx-analytics']));
}(this, (function (exports,core,ngxAnalytics) { 'use strict';
var NgxAnalyticsHubspot = (function () {
function NgxAnalyticsHubspot(ngxAnalytics$$1) {
var _this = this;
this.ngxAnalytics = ngxAnalytics$$1;
if (typeof _hsq === 'undefined') {
_hsq = [];
}
this.ngxAnalytics.pageTrack.subscribe(function (x) { return _this.pageTrack(x.path); });
this.ngxAnalytics.eventTrack.subscribe(function (x) { return _this.eventTrack(x.action, x.properties); });
this.ngxAnalytics.setUserProperties.subscribe(function (x) { return _this.setUserProperties(x); });
}
NgxAnalyticsHubspot.prototype.pageTrack = function (path) {
if (typeof _hsq !== 'undefined') {
_hsq.push(['setPath', path]);
_hsq.push(['trackPageView']);
}
};
NgxAnalyticsHubspot.prototype.eventTrack = function (action, properties) {
if (typeof _hsq !== 'undefined') {
_hsq.push(['trackEvent', properties]);
}
};
NgxAnalyticsHubspot.prototype.setUserProperties = function (properties) {
if (typeof _hsq !== 'undefined') {
_hsq.push(['identify', properties]);
}
};
NgxAnalyticsHubspot.decorators = [
{ type: core.Injectable },
];
NgxAnalyticsHubspot.ctorParameters = function () { return [
{ type: ngxAnalytics.NgxAnalytics, },
]; };
return NgxAnalyticsHubspot;
}());
exports.NgxAnalyticsHubspot = NgxAnalyticsHubspot;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=hubspot.umd.js.map