Tracking conversions
With the Yandex Metrica API, you can track user conversions on your site and supplement the data with offline conversions (for example, call information).
Goals
The API methods help you create and manage goals of various types, as well as use these goals to generate reports. For example, with a JavaScript event goal, you can track user clicks on the “Submit request” button. By adding this button to the report, you can get data on conversions for this goal.
Task | API method |
---|---|
Create a goal | POST /management/v1/counter/{counterId}/goals |
Edit a goal | PUT /management/v1/counter/{counterId}/goal/{goalId} |
Delete a goal | DELETE /management/v1/counter/{counterId}/goal/{goalId} |
Get information about available goals | GET /management/v1/counter/{counterId}/goals |
Get information about a specific goal | GET /management/v1/counter/{counterId}/goal/{goalId} |
Task | API method |
---|---|
Create a goal | POST /management/v1/counter/{counterId}/goals |
Edit a goal | PUT /management/v1/counter/{counterId}/goal/{goalId} |
Delete a goal | DELETE /management/v1/counter/{counterId}/goal/{goalId} |
Get information about available goals | GET /management/v1/counter/{counterId}/goals |
Get information about a specific goal | GET /management/v1/counter/{counterId}/goal/{goalId} |
Examples of conversion reports:
Offline conversions and calls
When a user visits your website, Yandex Metrica collects information about their characteristics, behavior on the site, and conversions. Your business may have other important information collected offline about payments, calls, and so on. You can pass this data to Yandex Metrica and link user behavior on the site to their actions offline.
Passing offline data can help you to:
- Connect users' online and offline history to get a better view of the conversion funnel.
- Advertise your business — you can create segments for advertising in Yandex Direct and target new users with the look-alike technology available in Yandex Audience.
You can transmit the following types of offline data:
Offline conversions. For instance, information about orders that were created on the site and paid for in the office. This data can be transmitted by the site owner via the Yandex Metrica web interface or the API.
Information about calls. This information is usually available from the call tracking service your company uses. It passes the data to Yandex Metrica over the API.
Data is passed in a CSV file.
What you need to pass data
- Tracking of offline conversions and calls
-
This option specifies the time interval during which the data about a conversion or call passed to Yandex Metrica can be added to the session data.
In some cases, there is quite a long delay between the session and the conversion, like if the conversion action is performed offline. This is why the conversion tracking period is 21 days. This means that data about a conversion is added to a session if 21 days or less have passed from the user's last session on the website to processing the file with the conversion data.
Offline conversions and calls are only added to sessions that take place after the option was enabled. The time interval for changing session information increases incrementally. On the day after enabling this option, the interval is one day, and it keeps getting longer until it reaches a maximum of 21 days.
Note. The option is enabled automatically when you pass offline data for the first time. However, the data you pass won't yet be matched to a user session and won't be displayed in Yandex Metrica reports. That's why you need to enable the option before the very first data submission.You can enable recording of:- Conversions: On the Yandex Metrica site or using the POST /management/v1/counter/{counterId}/offline_conversions/extended_threshold method.
- Calls: Using the POST /management/v1/counter/{counterId}/offline_conversions/calls_extended_threshold method.
A conversion isn't linked to a session if:
- It occurred or you passed the conversion data more than 21 days after the site session.
- The option is disabled.
If you use different IDs, conversion attribution methods will differ:
- ClientID and UserID. Offline conversions and calls are added to the user's session that directly preceded them. For example, the user had three sessions: March 1, March 5, and March 11. On March 10, this user paid for an order at a retail store, and this date was registered in the CRM. On March 20, the manager sent the data to Yandex Metrica. The order paid for on March 10 was added to the customer's website session as of March 5.
yclid. Conversions will be added to a session initiated through an ad linked to the transmitted yclid.
- Special IDs
-
This is the ID of a unique site user that Yandex Metrica creates automatically.
Used for tracking offline conversions and calls and transmitting user parameters.
Transmit data using the ClientID if, for example, your website doesn't have a system of user identifiers, or you don't need the identifiers that are used.
In this case, you should:- Get the IDs using the getClientID JavaScript API method.
- Send them with the other data in the CSV file.
The website user ID assigned by the website owner.
Used for tracking offline conversions and calls and transmitting user parameters.
Transmit data using UserID if your website already has a system for identifying users (for example, by username), and you are actively using this data.
In this case, you should:Your site user ID is associated with the ClientID of a particular user only if the setUserID method was called during the user's session. To get more complete statistics, we recommend waiting some time until a larger volume of data is transmitted to Yandex Metrica.- Set up ID transmission to Yandex Metrica using the setUserID JavaScript API method to associate the UserIDs with the ClientIDs.
- Send the UserIDs with the other data in the CSV file.
The ID of a click on a Yandex Direct ad assigned by Yandex Direct. It's used to link conversions to ads in Yandex Direct. With this ID, you can track conversions both on your site and offline.
How to pass data
For information on how to pass data, see the following sections: