@raona/sp
Version:
Raona utilities to work with Sharepoint using pnp/sp
48 lines (47 loc) • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var applicationinsights_web_1 = require("@microsoft/applicationinsights-web");
// import { AppInsightsProperties } from '../entities';
var AppInsightsService = /** @class */ (function () {
function AppInsightsService(instrumentationKey) {
this.instrumentationKey = instrumentationKey;
if (instrumentationKey.length > 0) {
this._appInsightService = new applicationinsights_web_1.ApplicationInsights({
config: {
instrumentationKey: instrumentationKey
}
});
this._appInsightService.loadAppInsights();
}
}
AppInsightsService.prototype.useApplicationInsightsRAW = function () {
return this._appInsightService;
};
AppInsightsService.prototype.trackPageView = function (user, client) {
if (this.instrumentationKey) {
this._appInsightService.trackPageView({
properties: {
"User": user,
"Client": client
}
});
}
};
AppInsightsService.prototype.trackCustomPageView = function (properties) {
if (this.instrumentationKey) {
this._appInsightService.trackPageView({
properties: properties
});
}
};
AppInsightsService.prototype.trackCustomEvent = function (eventName, eventProperties) {
if (this.instrumentationKey) {
this._appInsightService.trackEvent({
name: eventName,
properties: eventProperties
});
}
};
return AppInsightsService;
}());
exports.AppInsightsService = AppInsightsService;