> For the complete documentation index, see [llms.txt](https://helps.ptengine.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://helps.ptengine.com/cn/experience/setting/user-id-tag-setup.md).

# 用户识别标签的设置方法

## 标签的基本写法 <a href="#user-identification-tag-settings" id="user-identification-tag-settings"></a>

⚠️**注意事项**

示例标签仅供参考。在实际实施时，需要根据网站的结构和数据获取方法进行自定义。

如果无法获取识别ID，将作为匿名用户进行监测

考虑用户隐私，仅获取最必要的信息

```jsx
//用户识别标签
ptengine.identify('用户识别ID', {　
    用户标签1: '值',
    用户标签2: '值'
});

//实际设置示例
    if(userId){
        ptengine.identify(userId, { 
            free_registered_date: {{registered_date}},
            monthly_registered_date: {{pay_date}},
            member_status: {{member_status}},
            user_id: pickPatternIdFromAcVisitorUserId(getCookieValue('user_id'))
        }
```

### 📌 推荐设置位置 <a href="#recommended-setup-locations" id="recommended-setup-locations"></a>

在可以获取用户信息并确定身份的位置进行设置。例如：

登录页面

会员注册页面

用户信息更新页面

### 🔧 设置步骤 <a href="#setup-steps" id="setup-steps"></a>

1. 进入“数据管理”>“标签获取”
2. 选择“标签获取”>“用户识别”
3. 复制用户识别标签
4. 选定要监测的页面 用户信息获取页面（电子邮件、性别、ID等）
5. 具体操作发生页面（注册、登录、购买等）
6. 直接粘贴到第5步选定的页面

### 💡 标签的自定义 <a href="#tag-customization" id="tag-customization"></a>

用户识别ID：变动较少的唯一信息（例：账户ID）

用户标签：数据项目名称（例：姓名、性别、年龄）

值：用户输入的实际内容

### 🚀 实施要点 <a href="#implementation-points" id="implementation-points"></a>

在登录或注册完成的时刻激发标签

### 在表单提交时动态获取用户识别ID和值 <a href="#dynamically-obtain-user-id-on-form-submit" id="dynamically-obtain-user-id-on-form-submit"></a>

## **用户识别标签的设置实例** <a href="#user-identification-tag-setup-example" id="user-identification-tag-setup-example"></a>

🌟 场景：单击“注册”按钮时获取用户信息

### 📋 获取信息： <a href="#information-to-be-collected" id="information-to-be-collected"></a>

用户ID (uid)

电子邮件地址

电话号码

性别

年龄

注册日期

### 🔧 标签实现示例 <a href="#tag-implementation-example" id="tag-implementation-example"></a>

```jsx
document.getElementById('btnSignup').addEventListener('click', function() {
    ptengine.identify(document.getElementById('uid').value, {
        email : document.getElementById('email').value,
        phone : document.getElementById('phone').value,
        gender: document.getElementById('sex').value,
        age: document.getElementById('age').value,
        last_active_date: new Date()
    })
});
```

### 📊 使用示例 <a href="#usage-examples" id="usage-examples"></a>

通过此标签设置，可以详细分析用户的注册流程，并能够实施以下措施：

按年龄段进行转化率分析

根据性别提供个性化内容

基于注册日期的留存营销

基于此实现示例，请根据各网站的具体要求和安全政策进行自定义。

***

## 相关页面 <a href="#related-pages" id="related-pages"></a>

* [用户识别功能概览](https://helps.ptengine.com/cn/experience/setting/user-identification.md) — 先看这个
* [数据管理页面说明](https://helps.ptengine.com/cn/experience/setting/data-management.md) — 采集到的用户属性在哪看
* [如何创建用户组](https://helps.ptengine.com/cn/experience/user-group/create-segment.md)
* [基础代码的安装](https://helps.ptengine.com/cn/start-guide/quick/tag-setup.md)
