UNPKG

@grafana/runtime

Version:
49 lines (46 loc) 1.38 kB
import { config } from '../config.mjs'; import '../services/index.mjs'; import { getEchoSrv, EchoEventType } from '../services/EchoSrv.mjs'; import { locationService } from '../services/LocationService.mjs'; "use strict"; const reportMetaAnalytics = (payload) => { getEchoSrv().addEvent({ type: EchoEventType.MetaAnalytics, payload }); }; const reportPageview = () => { var _a; const location = locationService.getLocation(); const page = `${(_a = config.appSubUrl) != null ? _a : ""}${location.pathname}${location.search}${location.hash}`; getEchoSrv().addEvent({ type: EchoEventType.Pageview, payload: { page } }); }; const reportInteraction = (interactionName, properties) => { if (config.reportingStaticContext && config.reportingStaticContext instanceof Object) { properties = { ...properties, ...config.reportingStaticContext }; } getEchoSrv().addEvent({ type: EchoEventType.Interaction, payload: { interactionName, properties } }); }; const reportExperimentView = (id, group, variant) => { getEchoSrv().addEvent({ type: EchoEventType.ExperimentView, payload: { experimentId: id, experimentGroup: group, experimentVariant: variant } }); }; export { reportExperimentView, reportInteraction, reportMetaAnalytics, reportPageview }; //# sourceMappingURL=utils.mjs.map