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

20
web/global.d.ts vendored
View File

@@ -9,4 +9,22 @@ declare module 'lamejs/src/js/Lame';
declare module 'lamejs/src/js/BitStream';
declare module 'react-18-input-autosize';
export { }
declare global {
// Google Analytics gtag types
type GtagEventParams = {
[key: string]: unknown
}
type Gtag = {
(command: 'config', targetId: string, config?: GtagEventParams): void
(command: 'event', eventName: string, eventParams?: GtagEventParams): void
(command: 'js', date: Date): void
(command: 'set', config: GtagEventParams): void
}
// eslint-disable-next-line ts/consistent-type-definitions -- interface required for declaration merging
interface Window {
gtag?: Gtag
dataLayer?: unknown[]
}
}