dify/web/utils/gtag.ts
yyh 9161936f41
refactor(web): extract isServer/isClient utility & upgrade Node.js to 22.12.0 (#30803)
Co-authored-by: Stephen Zhou <38493346+hyoban@users.noreply.github.com>
2026-01-12 12:57:43 +08:00

17 lines
385 B
TypeScript

import { isServer } from '@/utils/client'
/**
* Send Google Analytics event
* @param eventName - event name
* @param eventParams - event params
*/
export const sendGAEvent = (
eventName: string,
eventParams?: GtagEventParams,
): void => {
if (isServer || typeof (window as any).gtag !== 'function') {
return
}
(window as any).gtag('event', eventName, eventParams)
}