---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://yandex.com/support/metrica/en/objects/first-party-params-hash.md
  - https://yandex.com/support/metrica/es/objects/first-party-params-hash.md
  - https://yandex.com/support/metrica/pt/objects/first-party-params-hash.md
  - https://yandex.com/support/metrica/ru/objects/first-party-params-hash.md
  - https://yandex.com/support/metrica/tr/objects/first-party-params-hash.md
  - https://yandex.com/support/metrica/zh/objects/first-party-params-hash.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/support/metrica/zh/llms.txt

# firstPartyParamsHashed（具有数据自散列功能）

<!-- source: zh/_includes/code/counter-initialize/id-counter-initialize/rest-js.md -->
{% note warning %}

使用 JavaScript API 需要了解 HTML 和 JavaScript。 如果您不了解这些语言，请联系您的网站开发人员或站长。

{% endnote %}
<!-- endsource: zh/_includes/code/counter-initialize/id-counter-initialize/rest-js.md -->


<!-- source: zh/_includes/objects/first-party-params/id-first-party-params/1.md -->
该方法适用于 HTTPS 网站。
<!-- endsource: zh/_includes/objects/first-party-params/id-first-party-params/1.md -->


<!-- source: zh/_includes/objects/first-party-params/id-first-party-params/2.md -->
发送有关网站用户的信息，以提高广告算法的性能并更准确地分析他们在网站上的行为。 这将帮助您提高广告系列的成效并详细了解用户行为，即使他们使用带有限跨站点跟踪 cookie（第三方 cookie）的浏览器，例如 Safari 和 Mozilla Firefox 亦可如此。
<!-- endsource: zh/_includes/objects/first-party-params/id-first-party-params/2.md -->


<!-- source: zh/_includes/objects/first-party-params/id-first-party-params/3.md -->
使用此方法进行第一次数据传输后，**Entering contact information**目标出现在 Yandex Metrica 中。 要启用此项，请选择[Automatic goals](https://yandex.com/support/metrica/zh/general/auto-goals.md)。
<!-- endsource: zh/_includes/objects/first-party-params/id-first-party-params/3.md -->



{% note alert %}

在发送数据之前，使用[数据散列](#hashing)。

{% endnote %}


```javascript
ym(XXXXXXXX, 'firstPartyParamsHashed', parameters);
```


#|
||
**参数**
|
**默认值**
|
**类型**
|
**描述**
||
||
`参数`*
|
—
|
Object
|
用户在网站上（例如，通过反馈表）留下的有关自己的信息。 先前散列的数据作为值传递，`yandex_cid` 除外。 示例：

```javascript ym(XXXXXXXX, 'firstPartyParamsHashed', {
     "email": '<SHA‑256 from mail@example.com>',
     "phone_number": '<SHA‑256 от 70123456789>',
     "first_name": '<SHA‑256 from John>',
     "last_name": '<SHA‑256 from Smith>',
     "yandex_cid": '1000034426'
 });
```
||

||
**parameters 对象的字段**：
|
>
|
>
||
||
`电子邮件`
|
—
|
String
|
[采用特定格式](#hashing)的电子邮件地址，使用 SHA-256 算法进行散列处理。

要测试散列处理，您可以使用电子邮件地址 `name@yandex.ru`。 散列应该是：`41b86f44151924a940be6fa30d93f2471683ca74ac361d3b827a9b72c80a7623`。

如果提供的电子邮件地址未经过散列处理，Yandex Metrica 将无法识别该地址。
||
||
`phone_number`
|
—
|
String
|
[采用特定格式](#hashing)的电话号码，使用 SHA-256 算法进行散列处理。

要测试散列处理，您可以使用电话号码 `‪‪‪‪70123456789‬‬‬`‬。 散列应该是：`8f0dd3d30a1ea4b739c6217c02604aee1556025da990212759efd877206a1948`。

如果提供的电话号码未经过散列处理，Yandex Metrica 将无法识别该号码。
||
||
`first_name`
|
—
|
String
|
用户的名字。
||
||
`last_name`
|
—
|
String
|
用户的姓氏。
||
||
`yandex_cid`
|
—
|
整数
|
[唯一 ID](https://yandex.com/dev/id/doc/dg/api-id/reference/response.html) (`ID`)。 如果您的网站使用 Yandex ID 授权，请发送它。
||
|#

<!-- source: zh/_includes/objects/first-party-params/id-first-party-params/params_options_starred.md -->
^*^ 必需参数。
<!-- endsource: zh/_includes/objects/first-party-params/id-first-party-params/params_options_starred.md -->


## 散列数据 {#hashing}

在进行散列处理前，需对数据进行规范化处理：确保数据均为小写，且开头和结尾不含逗号及空格（包括连续两个及以上的空格），**电子邮件**数据也需作此处理。

 
:   - 对于 Google 域中的地址（例如 `<name>@gmail.com`），删除名称中的点。 例如，将 `name.example@gmail.com` 替换为 `nameexample@gmail.com`。
    - 对于 Yandex 域上的地址（例如 `<name>@yandex.ru`），将名称中的点替换为破折号。 例如，将 `name.example@yandex.ru` 替换为 `name-example@yandex.ru`。
    - 将多个 Yandex 域上的地址（例如 `@ya.ru` 或者 `@yandex.com`）替换为 `@yandex.ru`。 例如：`example@yandex.ru`。
    - 如果名称使用“+”符号 (`name+commercial@example.com`)，只留下名称：`name@example.com`。

**phone_number**

 
:   - 该值只能包含数字。
    - 在号码中，将代码 8 替换为 7，且开头没有“+”号。 示例：`‪‪70123456789‬`‬。

除 Yandex 用户唯一标识符外（`yandex_cid`），所有数据必须使用 [SHA‑256](https://en.wikipedia.org/wiki/SHA-2) 算法进行散列处理。

具有散列值的参数示例：

```javascript
...
"name@yandex.ru": '41b86f44151924a940be6fa30d93f2471683ca74ac361d3b827a9b72c80a7623',
"70123456789": '8f0dd3d30a1ea4b739c6217c02604aee1556025da990212759efd877206a1948'
...
```

## 了解详情

- [检查高级跟踪设置的数据传输](https://yandex.com/support/metrica/zh/objects/check-first-party-params.md)

<!-- source: zh/_includes/buttons/chat-button.md -->
[与我们聊天](https://yandex.com/chat/#/user/036e6a02-3620-9cdc-4c5e-a34667a7379e?utm_source=spravka){.button}

<!-- source: zh/_includes/styles/href-to-button.md -->

<!-- endsource: zh/_includes/styles/href-to-button.md -->
<!-- endsource: zh/_includes/buttons/chat-button.md -->

<!-- source: zh/_includes/buttons/support-button.md -->
<div class="cut-button">

{% cut "发送电子邮件" %}

<!-- source: zh/_includes/popup/id-popup/wrong-sup.md -->
请注意：我们的支持团队永远不会主动给您打电话。 请勿按照自称为 Yandex Metrica 支持团队来电者的指示操作。
<!-- endsource: zh/_includes/popup/id-popup/wrong-sup.md -->

<div style="padding: 15px;
     margin: 10px 0;
     background: #FFFFFF;
     border-radius: 10px;
     border: 1px solid var(--g-color-line-generic);">
  <iframe style="background: #FFFFFF;"
        height="700"
        width="100%"
        frameborder="0"
        src="https://forms.yandex.com/surveys/1706/?&iframe=1&lang=en">
  </iframe>
</div>

{% endcut %}

</div>

<!-- source: zh/_includes/styles/cut-button.md -->

<!-- endsource: zh/_includes/styles/cut-button.md -->
<!-- endsource: zh/_includes/buttons/support-button.md -->

<!-- source: zh/_includes/footer-links.md -->
- - -

<div class="borderless-table">

#|
||
实用链接

- [演示计数器](https://metrica.yandex.com/r/dashboard?)
- [添加计数器](https://metrica.yandex.com/add/)
- [免费计数器设置](https://yandex.com/promo/freeservice/metrica?utm_source=help_metrica_en&utm_medium=cpc&utm_campaign=1)
- [Yandex Metrica API](https://tech.yandex.com/metrika/)
- [提出您的想法](https://yandex.com/support/metrica/troubleshooting/idea.html)
|
线上培训



- [参加培训课程](https://yandex.com/adv/edu/online/metrika?utm_source=metrika_help&utm_medium=web&utm_campaign=static&utm_content=useful_links)

||
|#

</div>

<!-- source: zh/_includes/styles/table-style.md -->

<!-- endsource: zh/_includes/styles/table-style.md -->
<!-- endsource: zh/_includes/footer-links.md -->
