---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.1
alternate:
  - https://yandex.com/support/metrica/en/data/user-params-data.md
  - https://yandex.com/support/metrica/es/data/user-params-data.md
  - https://yandex.com/support/metrica/pt/data/user-params-data.md
  - https://yandex.com/support/metrica/ru/data/user-params-data.md
  - https://yandex.com/support/metrica/tr/data/user-params-data.md
  - https://yandex.com/support/metrica/zh/data/user-params-data.md
  - href: en/data/user-params-data.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
title: Transmitting user parameters
description: Yandex Metrica lets you send any custom data, referred to as user parameters. For user parameters, we recommend transmitting user traits that don’t change from session to session and that don’t contain personal data such as the user’s name.
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/support/metrica/en/llms.txt


# Transmitting user parameters

<!-- source: en/_includes/code/counter-initialize/id-counter-initialize/rest-js.md -->
{% note 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.

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

Most of the session data is collected automatically by the Yandex Metrica tag. You can supplement it with your own data by transmitting [session parameters](https://yandex.com/support/metrica/en/data/visit-params-data.md). However, you may find that information about the users themselves is more useful than session statistics.

Yandex Metrica lets you send any custom data, referred to as _user parameters_. For user parameters, we recommend transmitting user traits that don’t change from session to session and that don’t contain personal data such as the user’s name. [Difference between user parameters and session parameters](https://yandex.com/support/metrica/en/general/how-it-works.md#difference)

If you want the parameters you passed to be reflected in reports, Yandex Metrica should link them to site users. To do this, the following special IDs are used: [ClientID](*ClientID) and [UserID](*UserID). Parameters are linked to sessions for users who visited the website within 90 days before the data was sent to Yandex Metrica.

{% note info %}

When transmitting user parameters specifying the ClientID and UserID, the total number of users in Yandex Metrica reports may differ from the number of IDs passed due to the way the UserID is bound to the ClientID.

{% endnote %}

The reports will be updated with the new information within a few hours. To view statistics, use the [User parameters report](https://yandex.com/support/metrica/en/reports/user-params.md). 

{% note info %}

Parameters sent to Yandex Metrica are stored for two years from the last upload. When the storage period ends, the report will no longer display the data.

{% endnote %}

{% cut "When to transmit the ClientID" %}

We recommend using the [ClientID](*ClientID) in transmitted data if you don’t need to get your own IDs in a report.

{% endcut %}

{% cut "When to transmit the UserID" %}

We recommend using the [UserID](*UserID) if, for instance, your site already has a user ID system and you need to get a report that shows these IDs.

{% endcut %}

You can send user parameters to Yandex Metrica in several ways:

- [During a site session](#online).
- Using a [CSV file at any time](#offline).

## Passing data during a site session {#online}

This method is useful when you are generating a report based on data received while the user is viewing the site.

User parameters are transmitted to Yandex Metrica through the JavaScript API. Information sent using this method cannot be deleted from Yandex Metrica.

To transmit the parameters at any other time, use the [userParams](https://yandex.com/support/metrica/en/objects/user-params.md) method. To transmit parameters during tag initialization, specify data in the [userParams](https://yandex.com/support/metrica/en/code/counter-initialize.md) parameter. The information is transmitted as JavaScript objects.

<!-- source: en/_includes/data/visit-params-data/id-visit-params-data/data1.md -->
The field value is processed as follows, depending on its type:
<!-- endsource: en/_includes/data/visit-params-data/id-visit-params-data/data1.md -->

- <!-- source: en/_includes/data/visit-params-data/id-visit-params-data/1.md -->
  **object** — Creates a new tree branch for each object key, and invokes the algorithm recursively for each value.
  <!-- endsource: en/_includes/data/visit-params-data/id-visit-params-data/1.md -->
    
- <!-- source: en/_includes/data/visit-params-data/id-visit-params-data/2.md -->
  **string** — Counts the number of times each different value of the string occurs.
  <!-- endsource: en/_includes/data/visit-params-data/id-visit-params-data/2.md -->
    
- <!-- source: en/_includes/data/visit-params-data/id-visit-params-data/3.md -->
  **number** — Calculates the total and average value of all numbers.
  <!-- endsource: en/_includes/data/visit-params-data/id-visit-params-data/3.md -->
    
- <!-- source: en/_includes/data/visit-params-data/id-visit-params-data/4.md -->
  **true**, **false** or **null** — Calculates the number of times each value occurs.
  <!-- endsource: en/_includes/data/visit-params-data/id-visit-params-data/4.md -->
    
Data will be bound to [ClientID](*ClientID) only if the `userParams` method was called during the user's session. To get more complete statistics, wait until a larger volume of data has been transmitted to Yandex Metrica.

> ## Example
> 
> Let's look at an online store that has two types of customers: “normal” and “VIP”. The client status data is stored in the site’s own database. After users sign in on the site, they see their usernames in place of the **Sign in** link on every page. If a user has a special status, it is shown next to the name: **Jane / VIP**. Along with the status, you can also transmit the user ID that is stored in your database.
> 
> To send data to Yandex Metrica, add code to all the site's pages that will call the `userParams` method.
> 
> For sending data about users with a special status, the code will look like this:
> 
> 
> {% list tabs %}
> 
> - At any time
> 
>   
>   ```javascript
>   ym(XXXXXXXX, 'userParams', {
>       vip_status: true,
>       child: 1,
>       child_age: 13,
>       UserID: 12345
>   });
>   ```
>   
> 
> - When initializing a tag
> 
>   
>   ```javascript
>   ym(XXXXXXXX, 'init', {
>       clickmap: true,
>       webvisor: true,
>       userParams: {
>           vip_status: true,
>           child: 1,
>           child_age: 13,
>           UserID: 12345
>       }
>   });
>   ```
> 
> {% endlist %}
> 
> 
> If information is being transmitted about a "normal" user, the code will look like this:
> 
> {% list tabs %}
> 
> - At any time
> 
>   
>   ```javascript
>   ym(XXXXXXXX, 'userParams', {
>       vip_status: false,
>       child: 1,
>       child_age: 13,
>       UserID: 12345
>   });
>   ```
>   
> 
> - When initializing a tag
> 
>   
>   ```javascript
>   ym(XXXXXXXX, 'init', {
>       clickmap: true,
>       webvisor: true,
>       userParams: {
>           vip_status: false,
>           child: 1,
>           child_age: 13,
>           UserID: 12345
>       }
>   });
>   ```
> 
> {% endlist %}
> 
> where `XXXXXXXX` is your counter number.
> 
> If a “normal” customer gets VIP status, the `userParams` method sends the new data to Yandex Metrica the next time this user signs in on the site. This new status will apply to the entire history of this user’s sessions, as if the customer was always VIP.

## Transmitting data in a CSV file at any time {#offline}

With this method, Yandex Metrica receives the data collected both during the site session and after the user left the site.

[Specification for the CSV format](http://www.rfc-editor.org/rfc/rfc4180.txt)

[CSV format description](https://en.wikipedia.org/wiki/Comma-separated_values)

#|

## Обязательные поля для передачи данных {#offline}

||
**Field name**
|
**Description**
|
**Example**
||
||
`clientID` \| `userID`
|
Site user ID
|
P12345
||
||
`key`
|
User ID. Maximum of 1,000 per user
|
age \| client.age
||
||
`value`
|
User ID value
|
40
||
|#

To send a hierarchical structure of parameters, use the "." symbol (dot). For example, to transmit multiple values of the `key` field, specify `client.demography.age`.

The maximum number of characters in fields shown in Yandex Metrica reports:
- `key` — 255;
- `value` — 50.

To pass information with a parameter:

{% list tabs %}

- ClientID

  
  1. Get the ClientID using the [getClientID](https://yandex.com/support/metrica/en/objects/get-client-id.md) method.
  1. Generate a CSV file specifying ClientID and submit it in the Yandex Metrica interface.
  

- UserID

  
  1. Send your UserID using the [setUserID](https://yandex.com/support/metrica/en/objects/set-user-id.md) method.
  1. Generate a CSV file specifying UserID and submit it in the Yandex Metrica interface.

{% endlist %}

### Working with a file {#data-send}

The Yandex Metrica interface lets you upload data and delete it. You can manage the file in **Settings** (find the **Upload data** tab and choose **User parameters**).

{% list tabs %}

- Uploading data
  
  To send a generated CSV file to Yandex Metrica:
  
  1. Click **Upload data**.
  1. In the window that appears, select the file type depending on the type of the ID you want to upload ([UserID](*UserID) or [ClientID](*ClientID)).
  1. Select the file on your computer and add comments to the upload, if necessary.
  1. Click **Upload data**.
  
  [Sample CSV file for uploading data](https://download.cdn.yandex.net/from/yandex.com/support/en/metrica/files/upload-data-example.csv)

- Deleting data
  
  To remove previously uploaded data or parts of it from the service, prepare a CSV file. The file should only contain the `key` field for the data you want to remove. Then follow these steps:
  
  1. Click **Delete data**.
  2. In the window that appears, select the file type to which you want to apply changes, depending on the ID ([UserID](*Идентификатор-посетителя-сайта,-заданный-владельцем-сайта,-например-при-входе-посетителя-сайта-в-личный-кабинет.) or [ClientID](*Идентификатор-уникального-посетителя-сайта,-который-Яндекс-Метрика-задает-автоматически.)).
  3. <!-- source: en/_includes/data/user-params-data/id-offline/1.md -->
     Select the file on your computer and add comments to the upload, if necessary.
     <!-- endsource: en/_includes/data/user-params-data/id-offline/1.md -->
      
  4. <!-- source: en/_includes/data/user-params-data/id-offline/2.md -->
     Click **Upload data**.
     <!-- endsource: en/_includes/data/user-params-data/id-offline/2.md -->
  
  [Sample CSV file for deleting data](https://download.cdn.yandex.net/from/yandex.com/support/en/metrica/files/delete-data-example.csv)

{% endlist %}

It takes some time for the service to process the file. Once processing is complete, the information you submitted becomes available in the User parameters report. 

<!-- source: en/_includes/buttons/chat-button.md -->
[Chat with us](https://yandex.com/chat/#/user/036e6a02-3620-9cdc-4c5e-a34667a7379e?utm_source=spravka){.button}

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

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

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

{% cut "Write an email" %}

<!-- source: en/_includes/popup/id-popup/wrong-sup.md -->
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.
<!-- endsource: en/_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/1705/?&iframe=1&lang=en">
  </iframe>
</div>

{% endcut %}

</div>



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

<!-- endsource: en/_includes/styles/cut-button.md -->

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

<!-- endsource: en/_includes/styles/href-to-button.md -->
<!-- endsource: en/_includes/reports/support-button.md -->

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

<div class="borderless-table">

#|
||
Useful links

- [Demo tag](https://metrica.yandex.com/r/dashboard?)
- [Add a tag](https://metrica.yandex.com/add/)
- [Free tag setup](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/)
- [Suggest your idea](https://yandex.com/support/metrica/troubleshooting/idea.html)
- [Discuss in Telegram](https://t.me/yandexmetrika)
|
Online training

- [Get a Yandex Metrica certificate](https://yandex.ru/adv/expert/exam/metrika/?utm_source=metrika_help&utm_medium=web&utm_campaign=static&utm_content=useful_links)


- [Take a training course](https://yandex.com/adv/edu/online/metrika?utm_source=metrika_help&utm_medium=web&utm_campaign=static&utm_content=useful_links)

||
|#

</div>

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

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

[*ClientID]: Unique website session ID created automatically by Yandex Metrica.

[*UserID]: User ID set by the site owner (for example, when the site user logs into their personal account).

[*Идентификатор-посетителя-сайта,-заданный-владельцем-сайта,-например-при-входе-посетителя-сайта-в-личный-кабинет]: User ID set by the site owner (for example, when the site user logs into their personal account).

[*Идентификатор-уникального-посетителя-сайта,-который-Яндекс-Метрика-задает-автоматически]: Unique website session ID created automatically by Yandex Metrica.