| 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 | |
| 8 | import type {TrackDataWithEventName} from 'isl-server/src/analytics/types'; |
| 9 | |
| 10 | import {Tracker} from 'isl-server/src/analytics/tracker'; |
| 11 | import {Internal} from '../Internal'; |
| 12 | |
| 13 | /** Client-side global analytics tracker */ |
| 14 | export const tracker = new Tracker(sendDataToServer, {}); |
| 15 | window.globalIslClientTracker = tracker; |
| 16 | |
| 17 | /** |
| 18 | * The client side sends data to the server-side to actually get tracked. |
| 19 | */ |
| 20 | // prettier-ignore |
| 21 | function 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 | |