Skip to main content
Use a custom metric when the built-in columns do not express the question you need to answer. For example, CV measures conversions per visit. If Event 1 is a submitted lead and Event 2 is an approved lead, your approval rate needs a different denominator. Custom formulas calculate from the numeric metrics in each report row. They also calculate on the totals row, using its totals. They do not define a new incoming event or change which events count as conversions.

Build an approval rate

Suppose your report contains 40 submitted leads in Event 1 and 12 approved leads in Event 2. The approval rate is 12 / 40 × 100 = 30%.
  1. Open the report’s metrics selector.
  2. Find Custom metrics and click Add custom metric.
  3. Enter approval_rate as Identifier.
  4. Enter this Formula:
  1. Choose Percent and click Add metric.
  2. Display Event 1 and Event 2 alongside the new column.
  3. Check that the example row displays 30%.
The ifnull fallback returns zero when division produces a non-finite value, such as a zero denominator. This keeps the display usable, but zero submissions still means there is no approval-rate evidence. Only use this formula when Event 1 and Event 2 have those meanings in the campaign being analyzed. Combining campaigns with different event mappings can create a mathematically valid but misleading percentage.

Choose the right display type

Custom Percent formatting does not multiply by 100. Include * 100 when the formula divides one count by another. For example, event2 / event1 returns 0.3, which would display as 0.3%, not 30%. Built-in rates use fractional API values, so a custom formula displaying built-in CV as a percentage would use cv * 100.

Use metric keys and supported arithmetic

Formulas use the case-sensitive keys from the metric dictionary, such as visits, lpclicks, uniqueVisits, revenue, cost, and event2. A UI label such as Clicks is not the formula key lpclicks. Use a clear identifier beginning with a letter or underscore and containing letters, numbers, or underscores. Choose a name that does not collide with an existing metric or a function. Adding the same custom identifier again replaces its definition. Supported syntax includes numbers, parentheses, unary plus or minus, and the operators +, -, *, /, and %. Here % means remainder, not percentage formatting. Supported functions are abs, ceil, floor, max, min, pow, round, sqrt, and ifnull. Use pow(x, 2) for a square. JavaScript property calls such as Math.round(...), comparisons, and conditional expressions are not supported.

Validate with a row you can calculate yourself

For 1,000 visits, USD 300 revenue, and USD 100 cost:
should return USD 0.20 with Currency formatting. For four order events with a combined value1 of 12, ifnull(value1 / event1, 0) should return three units per order event. Check both a normal row and a row with a zero denominator. Invalid formulas and non-finite results can display as zero, so a column of zeros is not proof that the formula is correct. Confirm metric spelling, supported syntax, and the underlying input columns.

Know where the definition lives

Custom metrics are saved in this browser’s local storage. They are not shared account definitions and are not automatically registered as metrics in the public reports API. Keep the formula separately if teammates or an external analysis need to reproduce it. Sorting a custom metric orders the rows currently loaded in the browser. It does not request a complete server-side ranking by that formula. For a full external ranking, retrieve the complete report dataset, calculate the formula, and sort that dataset. Use the remove control in the metrics selector when a definition is no longer needed. Removing it does not change stored tracking data.