feat: integrate Google Analytics event tracking and update CSP for script sources (#30365)

Co-authored-by: CodingOnStar <hanxujiang@dify.ai>
This commit is contained in:
Coding On Star
2025-12-30 18:06:47 +08:00
committed by GitHub
parent bf76f10653
commit 6ca44eea28
6 changed files with 125 additions and 24 deletions

14
web/utils/gtag.ts Normal file
View File

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