addons/isl/src/analytics/index.tsblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import type {TrackDataWithEventName} from 'isl-server/src/analytics/types';
b69ab319
b69ab3110import {Tracker} from 'isl-server/src/analytics/tracker';
b69ab3111import {Internal} from '../Internal';
b69ab3112
b69ab3113/** Client-side global analytics tracker */
b69ab3114export const tracker = new Tracker(sendDataToServer, {});
b69ab3115window.globalIslClientTracker = tracker;
b69ab3116
b69ab3117/**
b69ab3118 * The client side sends data to the server-side to actually get tracked.
b69ab3119 */
b69ab3120// prettier-ignore
b69ab3121function sendDataToServer(data: TrackDataWithEventName) {
b69ab3122 // In open source, we don't even need to bother sending these messages to the server,
b69ab3123 // since we don't track anything anyway.
b69ab3124 Internal?.sendAnalyticsDataToServer?.(data);
b69ab3125}