---
metadata:
  - name: generator
    content: Diplodoc Platform v5.48.2
alternate:
  - https://www.yandex.com/dev/metrika/en/management/calls.md
  - https://www.yandex.com/dev/metrika/ru/management/calls.md
---
> **Documentation Index:** Fetch the complete configuration index at https://www.yandex.com/dev/metrika/en/llms.txt

# Sending call data

## Step 1. Preparing data {#data}

Prepare [special IDs](https://www.yandex.com/dev/metrika/en/management/conversion.md#cpec-ids).

## Step 2. Preparing the CSV file {#csv}

Call data is sent in CSV format. There are several ways to send call data:

{% list tabs %}

- CSV file (recommended)

  In the file, specify the data that you want to pass to Yandex Metrica.

- multipart/form-data

  Be sure to pass the column names in the first line.

{% endlist %}

Required columns:

- `UserId`: Site user ID assigned by the site owner.
- `ClientId`: Site user ID assigned by Yandex Metrica.
- `Yclid`: ID of a click on a Yandex Direct ad assigned by Yandex Direct.
- `DateTime`: Date and time of the conversion in [Unix Time Stamp format](http://www.unixtimestamp.com/index.php). The time should be in the UTC+0 time zone.

Optional columns:

- `StaticCall`: Whether the call is static (1 — static, 0 — dynamic).

    {% cut "Static and dynamic calls" %}

    The type of call is determined by the call tracker. In a dymanic call, the call tracker assigns a different phone number to each user session. When Yandex Metrica receives a dynamic call from the call tracker, it links the call data to the nearest user session. Static calls aren't linked to user sessions. More information about [call tracking methods](https://ya.cc/t/PlSdbuP7AmqdM).

    Yandex Metrica doesn't link calls to users or user sessions in the following cases:

    - The transmitted user ID doesn't exist in the Yandex Metrica database.
    - The user session occurred after the call data was sent to Yandex Metrica or 21 days before the data was sent to the service.
    - Conversion tracking was enabled after the data was sent to Yandex Metrica,
 and the 21-day window for tracking conversions hasn't yet passed.

    {% endcut %}

- `Price`: Goal cost, with full stop (.) as the decimal separator.
- `Currency`: Currency code in three-letter ISO 4217 format.
- `PhoneNumber`: Phone number without spaces (with both country code and city code). For example, +70123456789.
- `TalkDuration`: Call duration in seconds.
- `HoldDuration`: Time on hold in seconds.
- `CallMissed`: Shows if the call was missed or answered (1 — missed, 0 — answered).
- `Tag`: Custom tag. It can be used to mark the quality of a call, its result, and so on. For example, “the customer was not satisfied with the price”.
- `FirstTimeCaller`: Shows if it was a first call or repeat call (1 — first call, 0 — repeat call).
- `URL`: Source URL for the call (the web page linked to the event). For example, this could be a campaign landing page with a phone number (PhoneNumber).
- `CallTrackerURL`: Click-through URL to the call tracker interface.

## Step 3. Sending data {#upload}

{% note info %}

Create a CSV data file and send it using this method. We recommend that you also automate your API queries using modules available in your programming language.

{% endnote %}

{% note info %}

The data will appear in Yandex Metrica reports within 2 hours of upload.

{% endnote %}

To transmit data, use the [POST /management/v1/counter/{counterId}/offline_conversions/upload_calls](https://www.yandex.com/dev/metrika/en/management/openapi/call/uploadCalls.md) method. The request includes the name of the goal that will be created when the data is sent. You can then add this goal to Yandex Metrica reports.

Make sure to include the OAuth token and the tag ID in your input data.

{% list tabs %}

- PHP

  ```php translate=no
  $counter = "";            // Specify the tag ID
  $token = "";              // Specify the OAuth token
  
  $curl = curl_init("https://api-metrika.yandex.net/management/v1/counter/{counterId}/offline_conversions/upload_calls");
  
  curl_setopt($curl, CURLOPT_POST, true);
  curl_setopt($curl, CURLOPT_POSTFIELDS, array('file' => new CurlFile(realpath('file.csv'))));
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data", "Authorization: OAuth $token"));
  
  $result = curl_exec($curl);
  
  echo $result;
  
  curl_close($curl);
  ```
  
- Python

  ```python translate=no
  import requests
  
  counter = 123456
  token = "token"
  
  file = open("offline-conversions.csv", "r").read()
  
  url = "https://api-metrika.yandex.net/management/v1/counter/{counterId}/offline_conversions/upload_calls".format(counter)
  headers = {
  	"Authorization": "OAuth {}".format(token)
  }
  
  req = requests.post(url, headers=headers, files={"file":file})
  ```

{% endlist %}

## What's next? {#other}

To track a call upload status, use the [GET /management/v1/counter/{counterId}/offline_conversions/calls_uploading/{id}](https://www.yandex.com/dev/metrika/en/management/openapi/call/findCallUploadingById.md) method.

## Learn more

- [Example of using a goal in the report](https://www.yandex.com/dev/metrika/en/stat/examples.md#conv)
