UNPKG

@shopware-ag/meteor-admin-sdk

Version:

The Meteor SDK for the Shopware Administration.

30 lines 1.24 kB
import { createSender } from '../channel'; import { findExtensionNameByBaseUrl } from '../_internals/utils'; /** * Dispatch a telemetry event to the Admin. * The source (technical name of the extension) is automatically * resolved by the Admin SDK from the message origin and cannot be * set manually by the extension. */ export const dispatch = createSender('telemetryDispatch'); /** * Resolves the technical name of the extension for the given origin URL. * Used on the Admin side when handling a telemetry event to inject the * source before forwarding the event to the tracking system. */ export const getSourceExtensionName = findExtensionNameByBaseUrl; /** * Track a page view, matching the `page_viewed` event emitted by the Admin. * Use this instead of `dispatch` to ensure consistent property names. */ export function trackPageView(properties) { return dispatch({ event: 'page_viewed', data: properties }); } /** * Track a link visit, matching the `link_visited` event emitted by the Admin. * Use this instead of `dispatch` to ensure consistent property names. */ export function trackLinkVisited(properties) { return dispatch({ event: 'link_visited', data: properties }); } //# sourceMappingURL=index.js.map