mirror of
https://github.com/outline/outline.git
synced 2026-11-30 00:50:41 +03:00
Google stopped processing UA data in July 2023, so the UA- path, autotrack plugins and ga() calls did nothing.
23 lines
513 B
TypeScript
23 lines
513 B
TypeScript
/**
|
|
* Helper class to track events across various analytics integrations
|
|
*/
|
|
export default class Analytics {
|
|
/**
|
|
* Send an event to Analytics
|
|
*
|
|
* @param event The event name
|
|
* @param action The action name
|
|
* @param metadata Additional parameters to attach to the event
|
|
*/
|
|
public static track = (
|
|
event: string,
|
|
action: string,
|
|
metadata?: Record<string, string>
|
|
) => {
|
|
// GA4
|
|
if (window.gtag) {
|
|
window.gtag("event", event, { action, ...metadata });
|
|
}
|
|
};
|
|
}
|