How to map order statuses

By mapping your CRM's order statuses to status types in Yandex Metrica, you can create segments based on statuses from your CRM and implement advanced logic for your goals.

There are 5 status types in Yandex Metrica:

  • IN_PROGRESS: In progress. Transmitting this status completes the goal CRM: Order created.
  • PAID: Paid (used by default if you don't transmit order statuses). Transmitting this status completes the goals CRM: Order created and CRM: Order paid.
  • CANCELLED: Canceled. Transmitting this status doesn't complete any goals.
  • SPAM: Spam. Similar to canceled orders, doesn't complete any goals.
  • OTHER: Orders in a different status. This status type is used automatically when you pass or manually specify a JavaScript goal ID as the order status.

You can use default statuses without mapping and transmit the IDs PAID, IN_PROGRESS, CANCELLED, and SPAM, or your tag's JavaScript goal IDs as the status (in this case, the status type is OTHER).

To map statuses, use the POST /cdp/api/v1/counter/{counterId}/schema/order_statuses method.

To view already mapped statuses, use the GET /cdp/api/v1/counter/{counterId}/schema/order_statuses method.

Data format for mapping order statuses

Parameters

Description

order_statuses

List of order statuses.

order_statuses

id

Order status ID.

humanized

Order status name.

type

Status type. Possible values:

  • IN_PROGRESS — In progress
  • PAID: Paid
  • CANCELED: Canceled
  • SPAM: Spam
  • OTHER — Other

goal_action_ids

JavaScript goal IDs.

How to use order status mapping

With mapping, you can use custom IDs assigned to your status types. In addition, mapping allows you to assign additional goals to any status. Let's look at an example:

Your CRM has several statuses:

  • Lead received
  • Bad lead
  • Good lead
  • Meeting scheduled
  • Contract signed

For each status, you set up mapping in Yandex Metrica:

  • Lead received

    • Status ID (id): new
    • Order status name (humanized): New lead
    • Status type (type): IN_PROGRESS.

    Once the statuses are mapped, sending new as the order status completes the CRM: Order created goal for that order, the New lead status name becomes available for segmentation in the Clients report, and the order appears in the Orders from CRM segmentation section in other reports.

  • Bad lead

    • Status ID (id): bad
    • Order status name (humanized): Bad lead
    • Status type (type): SPAM

    Once the statuses are mapped, sending bad as the order status doesn't complete any goals (because the SPAM status type doesn't entail sending a goal), the Bad lead status name becomes available for segmentation in the Clients report, and the order appears in the Orders from CRM segmentation section in other reports.

  • Good lead

    • Status ID (id): good_lead
    • Order status name (humanized): Good lead
    • Status type (type): IN_PROGRESS
    • Additional goal (goal_action_ids): good

    Once the statuses are mapped, sending good_lead as the order status completes the CRM: Order created goal for that order as well as the tag's JavaScript goal with the ID good. The Good lead status name then becomes available for segmentation in the Clients report, and the order appears in the Orders from CRM segmentation section in other reports.

  • Meeting scheduled

    • Status ID (id): new_meeting
    • Order status name (humanized): Meeting scheduled
    • Status type (type): IN_PROGRESS
    • Additional goal (goal_action_ids): meeting

    Once the statuses are mapped, sending new_meeting as the order status completes the CRM: Order created goal for that order as well as the tag's JavaScript goal with the ID meeting. The Meeting scheduled status name then becomes available for segmentation in the Clients report, and the order appears in the Orders from CRM segmentation section in other reports.

  • Contract signed

    • Status ID (id): new_payment
    • Order status name (humanized): Contract signed
    • Status type (type): PAID

    Once the statuses are mapped, sending new_payment as the order status completes the CRM: Order paid goal for that order. The Contract signed status name then becomes available for segmentation in the Clients report, and the order appears in the Orders from CRM segmentation section in other reports.

Warning

A unique goal can only be achieved once per order. In the example above, if you first transmit an order with the status new and later update it to good_lead, the CRM: Order created goal is achieved only once. Furthermore, you can't remove already sent goals from an order: updating an order's status from "new" to bad doesn't cancel the completion of the CRM: Order created goal that resulted from the "new" status.

Once the statuses are mapped, upload their IDs along with other order data using either the POST /cdp/apiv1/counter/{counterId}/data/orders/csv or POST /cdp/api/v1/counter/{counterId}/data/orders/json method.

Learn more about uploading orders