ngx-analytics
Version:
Vendor-agnostic web analytics for Angular2 applications, based on angulartics2
42 lines (39 loc) • 1.54 kB
JavaScript
import { Injectable } from '@angular/core';
import { NgxAnalytics } from 'ngx-analytics';
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: Injectable },
];
NgxAnalyticsHubspot.ctorParameters = function () { return [
{ type: NgxAnalytics, },
]; };
return NgxAnalyticsHubspot;
}());
export { NgxAnalyticsHubspot };
//# sourceMappingURL=hubspot.es2015.js.map