firstPartyParamsHashed (with data self-hashing capability)

Warning

Working with the JavaScript API requires knowledge of HTML and JavaScript. If you don’t know these languages, contact your website developer or webmaster.

The method is available for HTTPS websites.

Sends information about site users to improve the performance of advertising algorithms and more accurate analysis of their behavior on the site. This will help you increase the effectiveness of advertising campaigns and learn more about user behavior, even if they use browsers with limited cross-site tracking cookies (third-party cookies), such as Safari and Mozilla Firefox.

After the first data transfer using this method, the “Filling in contact details” goal will appear in Yandex Metrica. To do this, enable the Automatic goals option.

Alert

Before sending data, use data hashing.

ym(XXXXXX, 'firstPartyParamsHashed', parameters);

Parameter

Default value

Type

Description

parameters*

Object

Information that the user left about themself on the site, such as through the feedback form. The previously hashed data is passed as values, except for yandex_cid. Example:

     "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'
 });

Fields for the parameters object:

email

String

Email address in a specific format, hashed using the SHA-256 algorithm.

To test hashing, you can use the email name@yandex.ru. The hash should be: 41b86f44151924a940be6fa30d93f2471683ca74ac361d3b827a9b72c80a7623.

If the email address is provided in unhashed form, Yandex Metrica cannot recognize it.

phone_number

String

Phone number in a specific format, hashed using the SHA-256 algorithm.

To test hashing, you can use the phone 70123456789. The hash should be: 8f0dd3d30a1ea4b739c6217c02604aee1556025da990212759efd877206a1948.

If the phone number is provided in unhashed form, Yandex Metrica cannot recognize it.

first_name

String

User’s first name.

last_name

String

User’s last name.

yandex_cid

Integer

Unique ID of Yandex user (id). Send it if your website uses Yandex ID authorization.

* Required parameter.

Hashing data

Before hashing, normalize the data: ensure they are in lowercase, without commas and spaces (including double and more) at the beginning and end, as well as email

  • For addresses on the Google domain (such as <name>@gmail.com), remove dots from the name. For example, replace name.example@gmail.com with nameexample@gmail.com.
  • For addresses on the Yandex domain (such as <name>@yandex.ru), replace dots in the name with dashes. For example, replace name.example@yandex.ru with name-example@yandex.ru.
  • Replace addresses on multiple Yandex domains (such as @ya.ru or @yandex.com) with @yandex.ru. For example, example@yandex.ru.
  • If the name uses the “+” sign (name+commercial@example.com), only leave the name: name@example.com.

phone_number

  • The value may only contain digits.
  • In the number, replace code 8 with 7 without the “+” sign at the beginning. Example: 70123456789.

All data except the unique Yandex user identifier (yandex_cid) must be hashed using the SHA‑256 algorithm.

Example of parameters with hashed values:

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

Learn more

Chat with us

Write an email

Please note: Our support team will never initiate a call to you. Do not follow any instructions of people who call you and introduce themselves as the Yandex Metrica support team.