firstPartyParams

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.

Note. The data doesn't need to be hashed. During transfer, the data is hashed automatically and sent to Yandex Metrica in anonymized format.
ym(XXXXXX, 'firstPartyParams', parameters);
Attention. Enter parameter values in lowercase, without commas or spaces at the end.

Parameter

Default value

Type

Description

parameters *

Object

Information that the user left about themself on the site, such as through a feedback form.

ym(XXXXXX, 'firstPartyParams', {
    "email": 'mail@example.com',
    "phone_number": '70123456789',
    "first_name": 'Jon',
    "last_name": 'Smith',
    "yandex_cid": 1000034426,
    "home_address": {
        "street": '100 Main St',
        "city": 'Moscow',
        "region": 'Moscow',
        "postal_code": '12345', 
        "country": '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 String ZIP code.
country String Country.
yandex_cid Integer or String Unique ID of the Yandex user (id). Send it if your website uses Yandex ID authorization.

* Required parameter.