849 B26 lines
Blame
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8import type {TrackDataWithEventName} from 'isl-server/src/analytics/types';
9
10import {Tracker} from 'isl-server/src/analytics/tracker';
11import {Internal} from '../Internal';
12
13/** Client-side global analytics tracker */
14export const tracker = new Tracker(sendDataToServer, {});
15window.globalIslClientTracker = tracker;
16
17/**
18 * The client side sends data to the server-side to actually get tracked.
19 */
20// prettier-ignore
21function sendDataToServer(data: TrackDataWithEventName) {
22 // In open source, we don't even need to bother sending these messages to the server,
23 // since we don't track anything anyway.
24 Internal?.sendAnalyticsDataToServer?.(data);
25}
26