Custom metrics
Your own report column, calculated with a formula from built-in metrics.
A custom metric is a report column that the tracker calculates with your formula from built-in metrics, for example profit / clicks. Metrics are created on the Settings → Metrics («Настройки → Метрики») tab. They are shared by the whole team and appear in the column list of the report builder. Owners and admins can see the Settings section.
Creating a metric
- Open Settings → Metrics.
- Click + Metric («+ Метрика»). The “Custom metric” («Кастомная метрика») window opens.
- Fill in the fields — see Window fields.
- Click Save («Сохранить»).
The metric appears in the table with the Name («Название»), Key («Ключ»), Formula («Формула») and Format («Формат») columns. In the table, the format is written as number, currency or percent. While there are no metrics, the table says “No custom metrics” («Нет кастомных метрик»).
Window fields
| Field | What to enter | Rules |
|---|---|---|
| Name | The column header in the report, for example Net EPC | Always fill it in: without a name, the column header in the report table is empty |
| Key (Latin) («Ключ (латиница)») | The metric name, for example net_epc | Required. Latin letters, digits and _. Must not match the key of a built-in metric and must not start with cv_ |
| Formula | An expression, for example profit / clicks | Required. Up to 512 characters |
| Format | Number («Число»), Currency («Валюта») or Percent («Процент») | Number by default |
| Decimal places («Знаков после запятой») | How many decimal places to show in the report | From 0 to 6, 2 by default |
Key requirements:
- the first character is a letter and the length is up to 64 characters, otherwise a report with this column will not save;
- letters are lowercase: a key with uppercase letters cannot be listed in forbidden report fields. If the formula of such a metric contains a field that is forbidden for a staff member, the metric is hidden from them automatically, just like a metric with a lowercase key;
- each metric has its own key: the report finds the metric by its key.
Format and Decimal places change only how the value looks in the report:
- Number — a number with no symbols:
0.35. - Currency — with a dollar sign:
$0.35; a negative value is-$0.35. - Percent — with a percent sign:
35.00%. The value is not multiplied by 100: write the multiplication in the formula.
Formula
A formula can contain:
- the keys of built-in metrics from the table below;
- numbers with a period as the decimal separator:
100,0.7; - the operations
+,-,*,/and parentheses( ); - a minus before a number, a key or a parenthesis:
-cost.
Multiplication and division are done before addition and subtraction; operations of the same precedence go from left to right. Spaces are optional. Keys are written in lowercase, as in the table: the tracker will not recognize Clicks. There are no functions or comparisons.
| Key | Report column |
|---|---|
clicks | Clicks («Клики») |
unique_clicks | Uniq. («Уник.») |
bots | Bots («Боты») |
lp_clicks | LP clicks («LP-клики») |
lp_ctr | LP CTR |
conversions | Conv. («Конв.») |
leads | Leads («Лиды») |
sales | Sales («Продажи») |
rejected | Rej. («Отклон.») |
cost | Cost («Расход») |
revenue | Revenue («Доход») |
revenue_expected | Revenue (exp.) («Доход (ожид.)») |
profit | Profit («Прибыль») |
profit_expected | Profit (exp.) («Прибыль (ожид.)») |
roi | ROI |
roi_expected | ROI (exp.) («ROI (ожид.)») |
cr | CR |
approval | Approval («Аппрув») |
epc | EPC |
cpa | CPA |
cpl | CPL |
How each built-in metric is calculated is covered on the Report metrics and formulas page.
Examples:
profit / clicks
revenue / conversions * 0.7
sales / clicks * 100
(revenue_expected - cost) / leadsThe percentage metrics roi, roi_expected, cr, approval and lp_ctr go into the formula already as percentages: with an ROI of 25%, the value of roi is 25, not 0.25.
How the value is calculated
- The formula is evaluated separately for each report row.
- Division by zero gives 0. A row without clicks shows 0 for the formula
profit / clicks. - In the “Total” («Итого») row, the formula is applied to the total values of the metrics. For
profit / clicks, this is the whole profit of the report divided by all clicks, not the sum of the row values.
The metric in a report
- Open the Reports («Отчёты») section.
- Click Columns («Колонки»).
- In the Available («Доступные») block, click the + button with the metric name. The column is added to the end of the list.
- Move the column to the right place with the ↑ and ↓ buttons or by dragging.
Click the column header to sort the report by the metric. The column is included in saved reports. In a CSV export, the column header is the metric key and the values are unrounded numbers without the $ and % signs, see What is inside the CSV.
If a staff member has a forbidden report field, metrics whose formula contains that field are not in their Columns list. For example, with cost forbidden, metrics whose formula contains cost, profit or roi disappear. The letter case of the metric key does not matter here. A report with such a metric in its columns or sorting is not built for this staff member.
Editing and deleting
- To edit a metric, click its name in the table. The same window opens with the fields filled in.
- To delete one, click ✕ in the row and confirm the prompt “Delete metric ‘…’?” («Удалить метрику «…»?»).
After you delete a metric or change its key, reports with this column, including saved ones, are not built and show the error unknown metric "net_epc". To get the report built:
- Click Columns in the report.
- Remove the column with the old key using the × button.
- Choose another field in the Sort («Сортировка») list if the report was sorted by this metric.
The same actions with metrics are available through the API — see Admin API: reports.
Limitations
- A formula cannot refer to another custom metric or to conversion type columns — only to the keys from the table above.
- Report filters have no custom metrics: you can filter only by built-in ones.
- Custom metrics exist only in the report builder. They are not in the campaign statistics, the campaign list or the dashboard.
- The financier's Columns list contains only built-in metrics.
Error messages
The key and formula are checked when you save. If there is an error, the metric is not saved and the window stays open. The message appears on the Metrics tab above the table, under the window. To read it, close the window with the Cancel («Отмена») button. Unsaved field values are lost when you close it, so copy the formula first.
Name and formula are required («name и formula обязательны»)
The Key (Latin) or Formula field is empty. Fill in both.
Name matches a built-in metric («имя совпадает с базовой метрикой»)
The key matches the key of a built-in metric, for example epc, or starts with cv_. Set a different key, for example net_epc.
Name may contain only Latin letters, digits and _ («имя — только латиница, цифры и _»)
The key contains a space, a hyphen, Cyrillic or another character. Keep only Latin letters, digits and _.
Formula error: unknown metric "…" («ошибка в формуле: неизвестная метрика "…"»)
The formula contains a word that is not among the built-in metric keys: a typo, uppercase letters or the key of another custom metric. Check it against the key table.
Formula error: invalid character "…" («ошибка в формуле: недопустимый символ "…"»)
The formula contains a character outside the allowed list: a comma instead of a period in a number, %, ^, quotes, Cyrillic. Remove it.
Formula error: expected ) («ошибка в формуле: ожидалась )»)
A parenthesis is not closed. The messages “unexpected end of formula” («неожиданный конец формулы») and “extra token "…"” («лишний токен "…"») also point to syntax: the formula ends with an operation sign, a sign between two values is missing, or there is an extra closing parenthesis.
Formula error: formula longer than 512 characters («ошибка в формуле: формула длиннее 512 символов»)
Shorten the formula. The message “empty formula” («пустая формула») means the field contains only spaces.