Browse Source

feat: add Google Analytics (GA4) configuration (#11739)

* fix: resolve CF Worker Date.now() returning 0 at module level

In Cloudflare Workers, module-level Date.now() evaluates to 0 during
initialization, causing all time-dependent data (visitData dates,
offlineChartData times, activities updatedAt) to render as epoch-zero
values (1970-01-01, 0:00). This broke the analysis dashboard charts
on the preview site.

Convert static module-level data exports to functions that generate
data at request time, ensuring Date.now() returns the current time.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat: add Google Analytics (GA4) configuration

Add ga_v2 tracking ID G-59NF1VHHPF via Umi Max analytics plugin.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
pull/11754/head
Alex Zhu 5 months ago
committed by GitHub
parent
commit
39330880e4
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      config/config.ts

8
config/config.ts

@ -173,6 +173,14 @@ export default defineConfig({
* @doc https://umijs.org/docs/max/access * @doc https://umijs.org/docs/max/access
*/ */
access: {}, access: {},
/**
* @name Google Analytics
* @description 使用 GA4 (gtag.js) 进行站点分析
* @doc https://umijs.org/docs/max/analytics
*/
analytics: {
ga_v2: 'G-59NF1VHHPF',
},
/** /**
* @name <head> 中额外的 script * @name <head> 中额外的 script
* @description 配置 <head> 中额外的 script * @description 配置 <head> 中额外的 script

Loading…
Cancel
Save