如何设置访客姓名或 ID Google 分析

How to set Visitor Name OR ID Google Analytics

如何使用 gtag 设置访问者姓名或 ID 并将其显示在 Google 分析页面命中

我已经试过了,但是没有给访问者。

  gtag('config', 'My_key', {
    'page_title': title,
    'page_path': window.location.pathname,
    'user_id': visitor
});

例如:-

UserID Page Title
user1 home/index
user2 home/other

您必须创建一个 User-ID 视图 才能看到该值 (https://support.google.com/analytics/answer/3123669),或者如果您想在您的普通视图中看到该信息将其作为 自定义维度.

传递