[UA] About calculated metrics [Beta][Legacy]

You are viewing a legacy article about Universal Analytics. Learn more about Google Analytics 4 replacing Universal Analytics.
This Universal Analytics feature is only available for websites using gtag.js or analytics.js. Using ga.js (Classic Analytics) will stop Referral Exclusions from working.

Calculated Metrics are user-defined metrics that are computed from existing metrics and drive more relevant analyses and enable greater actionability without leaving the product.

In this article:

Creating calculated metrics

To create a new calculated metric in Analytics follow these steps:

  1. Sign in to Google Analytics..
  2. Click Admin, and navigate to the view you want.
  3. In the VIEW column, click Calculated Metrics > NEW CALCULATED METRIC

You'll then see the Add Calculated Metric interface:

Enhanced Ecommerce: Add Calculated Metric user interface

To create a calculated metric you need to populate the following fields and click the Create button when finished.

  1. Name – Provide a descriptive name (i.e. "Average Order Value"). This will appear in the Metric selector for custom reports.
  2. External Name – Automatically populated based on the value entered in the Name field and should not be modified. It can be changed from the recommendation during creation but it cannot be changed after it is created. The External Name value must be unique.
  3. Formatting Type:
    • Integer (with customizable decimal places)
    • Currency (Decimal)
    • Time
    • Float
    • Percentage (with customizable decimal places)
  4. Formula – Start typing and you'll see a list of predefined metrics which you can use to create a formula. Accepted operators include:
    • Plus (+)
    • Minus (-)
    • Divided by (/)
    • Multiplied by (*)
    • Parenthesis
    • Positive cardinal numbers (0-9), can include decimals
    Using the minus operator as a negative is unsupported (i.e. A-B is supported, but -B+A is not). Formulas are limited to 1024 characters. Up to 5 (Standard) and 50 (360) calculated metrics are supported at the view level.

Note: Using another custom calculated metric in the creation of a new calculated metric isn't supported.

Using the Formula field and input examples

The Formula field provides a quick way to create and modify formulas using the following inputs:

  • Standard metrics – (e.g. Total Events, Unique Visitors)
  • Custom metrics – (e.g. Number of members, scores, awards, or points)
  • Constants – (e.g. 1.31*Revenue for currency conversion from USD to EUR)
    Best practice is to add .0 to whole numbers, e.g., 13.0.

Note: Combining currency and non-currency values in the Formula field is not supported and may lead to unexpected results.

Using calculated metrics

Once created, calculated metrics are available at query-time in the following locations:

Note: In order to access a calculated metric via API, all constituent metrics must also be available by API.

Use cases

Example 1: Revenue Per User

CalculatedMetricsRevenuePerUser
  • Name: Revenue Per User
  • External Name: (automatically populated)
  • Formatting Type: Currency (Decimal)
  • Formula: {{Revenue}} / {{Users}}

Example 2: Currency conversion

CalculatedMetricsGBPtoEUR
  • Name: Revenue from GBP to EUR
  • External Name: (automatically populated)
  • Formatting Type: Currency (Decimal)
  • Formula: {{Revenue}} * 1.27

Related resources

Developer resources  google-developers-svg

Use the environment-specific instructions in our Developer Guides to set up calculated metrics.

Was this helpful?

How can we improve it?
true
Choose your own learning path

Check out google.com/analytics/learn, a new resource to help you get the most out of Google Analytics 4. The new website includes videos, articles, and guided flows, and provides links to the Google Analytics Discord, Blog, YouTube channel, and GitHub repository.

Start learning today!

Search
Clear search
Close search
Google apps
Main menu