fix(analytics): 更新Google Analytics配置和变量命名
更新环境变量命名以匹配GA4标准,并调整默认存储权限配置 添加页面浏览跟踪逻辑,当用户同意分析时发送页面数据
This commit is contained in:
@@ -174,6 +174,14 @@ export const updateConsentDetailed = (preferences: CookiePreferences) => {
|
||||
personalization_storage: preferences.marketing ? 'granted' : 'denied',
|
||||
security_storage: 'granted',
|
||||
});
|
||||
|
||||
if (preferences.analytics) {
|
||||
window.gtag('config', GA_MEASUREMENT_ID, {
|
||||
page_path: window.location.pathname + window.location.search,
|
||||
page_title: document.title,
|
||||
page_location: window.location.href,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user