firstPartyParamsHashed (with data self-hashing capability)

Tip. 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 “Entering contact information” goal appears in Yandex Metrica. To enable this, select Automatic goals.

Attention. 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 a feedback form. The previously hashed data is passed as values, except for yandex_cid. Example:

ym(XXXXXX, 'firstPartyParamsHashed', {
    "email": '<MD5 of mail@example.com>',
    "phone_number": '<MD5 of 70123456789>',
    "first_name": '<MD5 of Jon>',
    "last_name": '<MD5 of Smith>',
    "yandex_cid": '1000034426',
    "home_address": {
        "street": '<MD5 of 100 Main St>',
        "city": '<MD5 of Moscow>',
        "region": '<MD5 of Moscow>',
        "postal_code": '<MD5 of 12345>', 
        "country": '<MD5 of Russia>'
    }
});
parameters object fields

Parameter

Default value Type

Description

email

string

Email address.
phone_number string Phone number without spaces in the format 70123456789.
first_name string User's first name.
last_name string User's last name.
home_address string User's addresses.
street string Street.
city string City.
region string Region.
postal_code Integer ZIP code.
country string Country.
yandex_cid Integer Unique ID of the Yandex user (id). Send it if your website uses Yandex ID authorization.

* Required parameter.

Hashing data

Before hashing, normalize the data: make sure that it's entered in lowercase, without commas and spaces (including double or more) at the beginning and end, as well as:
email
  • For addresses on the Google domain (such as <name>@gmail.com), remove dots in 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 instance, 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 code, use 7 instead of 8, without the “+” sign at the beginning. For example: 70123456789.

Be sure to hash all the data except the unique Yandex user ID (yandex_cid), using the MD5 or SHA-256 algorithm.

Example of parameters with hashed values:

...
"email": '78ee6d68f49d2c90397d9ff77fc3814d1',
"phone_number": 'a31259d185ad013e0a663437c605d056'
...