【发布时间】:2019-11-14 16:41:00
【问题描述】:
这与使用 gtag 在谷歌分析调用中设置用户 ID 有关。
1.) 文档说以这种方式设置用户 ID:
gtag('config', 'GA_MEASUREMENT_ID', {
'user_id': 'USER_ID'
});
(参考:https://developers.google.com/analytics/devguides/collection/gtagjs/cookies-user-id)
2.) 但是在分析控制台中实际设置用户 ID 功能时,那里的注释说要以这种方式设置用户 ID:
gtag('set', {'user_id': 'USER_ID'}); // Set the user ID using signed-in user_id.
// The value must be set for all hits in the session. We recommend using the set method to ensure all additional Analytics hits on the page contain this value.
那么...哪个最好,为什么?谢谢!
【问题讨论】:
标签: google-analytics