# Calculated metrics in Google Analytics – Complete Guide

‘Calculated metric’ is a type of user defined metric.

The another type of user defined metric is called the ‘**custom metric**’.

‘Calculated metric’ is different from ‘custom metric’, in the way it is: configured, collected and processed in Google Analytics.

## Following are the key differences between Custom Metrics and Calculated Metrics:

#1 ‘Custom metric’ is configured/defined at the property level. Whereas, ‘calculated metric’ is configured at the view level.

#2 Custom metric is used to collect the data which Google Analytics does not automatically collect (like phone call data, CRM data etc). Whereas ‘‘Calculated metric’ is used to collect/compute new data, from the already available data in GA. Calculated metric’ is used to perform some very basic calculations on existing metrics. For example, addition of two or metrics, multiplication of two or more metrics or dividing a metric by a constant etc.

#3 The values of a custom metric is processed and reported in GA, only when the new data is available in GA. Whereas, the values of calculated metric is processed and reported, as soon as the calculated metric is configured. Because of that reason, you can see data for your calculated metrics, as soon you set them up.

#4 Custom metrics do not work retroactively i.e. they do not collect and report on historical data. Whereas, calculated metrics can work retroactively i.e. they can collect and report on historical data.

#5 Custom metrics are not **compound metrics** i.e. their value does not depend upon the value of other metrics. Whereas, calculated metrics are compound metrics. The advent of calculated metrics, provide the possibility of creating **compound metrics** in GA.

## Attributes of a Calculated Metric

A Calculated metric has got following four attributes:

- Name
- External Name
- Formatting Type
- Formula

## #1 Name

This is the web view name (or User interface name) of a calculated metric.

We identify a metric in a GA report, through its web view name:

Other examples of web view names:

It is a good practice to use descriptive names for your calculated metrics, so that a recipient of your report, can easily understand, what the metric is all about and/or what data it is supposed to report upon.

For example, ‘** CalcMetric1**’ is a bad name for a calculated metric.

‘** Newsletter Subscriptions Per Session**’ is a good name for a calculated metric, as it clearly defines, what the metric is all about.

**Note**: You can change the web view name of a calculated metric, any time you like and it will work retroactively.

## #2 External Name

This is the ‘API name’ of the calculated metric.

When we access Google Analytics directly via API, we use the API name of a metric/dimension, instead of the web view name.

For example, the API name for calculated metric, we created earlier, is: ‘** calcMetric_NewsletterSubscriptionsPerSession**’:

Google automatically creates the API name for your calculated metric.

But you can change it to something else, if you like.

However, once the calculated metric is set up, you can’t change its ‘external’/API name again:

## #3 Formatting Type

This configuration setting is used to set the format in which GA should report on the values of the calculated metrics.

There are 5 formatting types available in GA:

- Float
- Integer
- Currency (decimal)
- Time
- Percent

You can select these formatting types from ‘Formatting Type’ drop down menu:

## #1 Float (or Floating point number)

Float stands for ‘floating point number’. It is the number which has got digits after the decimal point.

A floating point number can be positive or negative number but in the case of GA, it needs to be a positive number.

GA does not support negative floating point numbers for computing calculated metrics.

Following are examples of floating point numbers which are valid for creating a calculated metric:

2.34, 1.98, 3.00, .45, 9.0 etc.

Following is an example of floating point number which is not valid for creating a calculated metric: ‘-2.34’.

Also worth noting, is that Google Analytics can take into account, any number of digits after the decimal point, in its computation of calculated metrics, but always report floating point numbers with only two digits after the decimal point.

For example, the following formula:

*{{Newsletter Subscription Confirmed (Goal 13 Completions)}} * .01*

can produce different output, than the formula one below:

*{{Newsletter Subscription Confirmed (Goal 13 Completions)}} * .006*

or the formula one below:

*{{Newsletter Subscription Confirmed (Goal 13 Completions)}} * .006009*

Here GA is not going to round off the number .006 or .006009 to .01 but instead use the number .006 or or .006009 in computing the value of the calculated metrics.

However GA will always report a floating point number with only two digits after the decimal point and in case of reporting, may round off a number to the two decimal digits.

So if number of ‘Goal 13 completions’ is say 50,000 then the computed value for the calculated metrics could be:

50000 * .01 = 500.00

(according to the formula: *{{Newsletter Subscription Confirmed (Goal 13 Completions)}} * .01** )*

Or

50000 * .006 = 300.00

(according to the formula: *{{Newsletter Subscription Confirmed (Goal 13 Completions)}} * .006** )*

Or

500 * .006009 = 300.45

(according to the formula: *{{Newsletter Subscription Confirmed (Goal 13 Completions)}} * .*006009*)*

## #2 Integer

An integer is a whole number.

It is a number without a decimal point and it can be positive (like 12), negative (like -12) or Zero (0).

However Google Analytics supports only positive integers and zero for computation of calculated metrics.

Negative integers are not supported.

## #3 Currency (decimal)

This configuration setting is used to format the value of a calculated metric as ‘currency’.

In the context of GA, currency is the combination of currency symbol and floating point number.

The currency symbol that is used, is the one which is set up under your view’s settings.

So for example, if pound is set up under ‘* currency displayed as*’ view setting:

Then the values of your calculated metric will be displayed in pounds.

## #4 Time

This configuration setting is used to format the value of a calculated metric in hours, minutes and seconds format.

For example: 02:46:40

**#5 Percent**

This configuration setting is used to format the value of a calculated metric in percentage format.

For example: 12%

**Note**: You can change the formatting type of a calculated metric, any time you like and it will work retroactively.

## Formula

Formula is an arithmetic expression that must return a numeric value.

An arithmetic expression is made up of numbers, arithmetic operators (+, -, *, / ) and sometimes parenthesis.

Following are examples of arithmetic expressions:

1+3

1-3

1*3+4.21 /100

100 + (1 +(250 / 108)) * 3.561

However unlike regular arithmetic expressions, the expression used to compute calculated metrics can not be made up of just constants.

It must include at least one metric.

For example, following formula is invalid:

**10 + 5**

However the formula below is valid:

**10 + 5 + {{Newsletter Subscription Confirmed (Goal 13 Completions)}}**

**You can use following arithmetic operators in your formula:**

- + (plus)
- – (minus)
- / (divide)
- * (multiply)

The order of operations (or operator precedence) is a set of rules that define which operation to perform first, in order to evaluate a given expression.

For example, multiplication precedes addition.

Operator precedence can be overridden by using parenthesis.

All the usual operator precedence rules, are applicable for the expressions which are used as formulas for calculated metrics.

**You can not use any negative value in your formula.**

For example, following formula is invalid:

*{{Newsletter Subscription Confirmed (Goal 13 Completions)}} * -125*

**The length of your formula can not be longer than 1024 characters.**

**Parenthesis are allowed in a formula**

Just like regular arithmetic expressions, the expression used to compute calculated metrics can include parenthesis.

For example, following formulas are valid:

**{{Newsletter Subscription Confirmed (Goal 13 Completions)}} / (10 + 5)**

**{{Newsletter Subscription Confirmed (Goal 13 Completions)}} / 100 + (1 +(250 / 108)) * 3.561**

**Square brackets are not allowed in a formula**.

For example, following formula is invalid:

**{{Newsletter Subscription Confirmed (Goal 13 Completions)}} / 100 + (1 +[250 / 108]) * 3.561**

GA automatically surrounds all metrics with double curly braces.

So for example, if you select ‘Revenue’ from the drop down menu, GA will surround the ‘Revenue’ metric with double curly braces {{Revenue}} :

However, if you accidentally added one extra curly brace, your expression will become invalid:

You can also use an expression as a formula which does not include any arithmetic operator.

For example, following formula is perfectly valid:

*{{Newsletter Subscription Confirmed (Goal 13 Completions)}}*

The expression which return a string or the expression which return a Boolean value (true or false), can not be used as formula for computing calculated metrics.

**You can create a calculated metric which is based on a custom metric:**

**You can create a calculated metric which is based on a predefined goal in GA:**

**You can not create a calculated metric which is based on another calculated metric(s). **

**Note**: You can change the formula used for a calculated metric, any time you like and it will work retroactively.

## How to use, up to 250 different calculated metrics for your analysis

Standard Google Analytics provide only 5 calculated metrics per view.

If you are using Google Analytics 360 (aka GA premium), you can then use up to 50 calculated metrics per view.

So if you wish to use more than 5 calculated metrics, while still using GA standard, you can do that, by creating 5 different calculated metrics for each view.

In Google Analytics, you can create 25 views per GA property.

So if you can create 24 duplicate views of your main view, you can technically, create and use 25 X 5 = 125 different calculated metrics for your website analysis.

Now if you use more than one GA property for your website by using multiple trackers, you can technically, create and use 125 different calculated metrics per property.

For example, I use two different GA properties for optimizesmart.com website.

So technically, I can create and use up to 125 * 2 = 250 different calculated metrics for my website analysis.

*Another advantage of using a second GA property is that, i get to use, way more custom dimensions and custom metrics than any standard GA user. *

For example, in GA standard you can create only 20 custom dimensions and 20 custom metrics per property.

But since I use two GA properties, i can create and use up to 40 custom dimensions and 40 custom metrics for my website analysis.

Technically, i can create and use dozen of GA properties for my website and can thus create and use hundreds of custom dimensions and custom metrics, far more than that are available in GA premium (200).

Of Course using so many trackers is going to have some ‘side effects’.

But what i am saying here, is that, it is technically possible to increase the number of slots available to you (for custom dimensions/ custom metrics/ calculated metrics), at will, without paying the annual fees of US $150k (the price to use GA 360).

## Stages for setting up Calculated Metrics

There are three stages for creating and using calculated metrics in GA:

- Planning
- Justification
- Staging

### #1 Planning

At this stage you determine your tracking requirements. What type of data you wish to collect via calculated metric.

### #2 Justification

Standard Google Analytics provide only 5 calculated metrics per view.

So you have limited slots available for calculated metrics, and if for some reason, you can’t increase the number of slots available to you, then you need to think twice, before using any available slot.

In the justification phase, you present a case study, which justify your reasoning for choosing ‘calculated metric’ slot for tracking the type of data, you wish to collect in GA.

You can also the same justification for using a slot, meant for custom dimension or custom metric, as they are in limited supply.

There is almost always, some other method available, to collect and report your desired data.

In the justification phase, you explore all available options and make an informed decision regarding, whether or not to use a calculated metric slot.

**Use a calculated metric slot only when it is absolutely necessary.**

Avoid wasting slots for tracking trivial/vanity metrics like ‘blog views per user’, ‘average time per user’ etc.

I think it is a good practice, not to waste available slots, for tracking that website usage data, which does not really matter.

### #3 Configuration

At this stage you configure GA view settings, in order to set up ‘calculated metrics’.

## Setting up calculated metric in Google Analytics

To create a new calculated metric in Google Analytics follow the steps below:

**Step-1**: Determine your tracking requirements and make an informed decision regarding whether or not to use a calculated metric.

**Step-2**: Login in to your Google Analytics account and then navigate to your main view (the view that you use for analysis purpose).

**Step-3**: Navigate to the ‘admin’ section of your view and then click on the link ‘*Calculated Metrics*’ (under the ‘view’ section):

**Step-4**: Click on the ‘New Calculated Metric’ button:

**Step-5**: Enter a descriptive name for your new calculated metric, select formatting type (from the drop down menu) and then enter your formula:

**Step-6**: Click on the ‘create’ button to complete the setup:

If you wish to copy or delete your calculated metric, just click on the drop down arrow button next to ‘Actions’:

## Using calculated metrics in Google Analytics reports

You can use calculated metrics in any custom report and/or dashboard widgets.

However calculated metrics are not available in standard GA reports.

To use calculated metrics, follow the steps below:

**Step-1**: Create a new custom report in your GA view.

**Step-2**: Navigate to the ‘metric group’ section of your custom report and then click on the ‘add metric’ button:

**Step-3**: Enter the name of your calculated metric in the text box and then select it from the drop down menu:

## When to use calculated metrics

Calculated metrics are ideal, whenever you want to report on a **compound metric** in GA.

One of the most popular compound metric is, ROI (Return on Investment).

Let us suppose you wish to report on the SEO ROI which can be calculated as:

*ROI= (Total E-Commerce Revenue from organic search – cost of running the SEO campaign) / cost of running the SEO campaign*

The formula for calculating this ROI in GA may look like the one below:

( {{SEO Revenue}} – 3500 ) / 3500

Here, SEO revenue is a custom metric:

## Using calculated metrics via core reporting API

Instead of trying to retrieve the values of a calculated metric via the API, you can compute the value of calculated metric within Google Spreadsheet.

Follow the steps below:

**Step-1**: Install ‘**Google Analytics Spreadsheet add-on’** from here.

**Step-2**: Open a new Google Spreadsheet and then go to Add-ons menu > Google Analytics > ‘Create New Report’:

**Step-3**: Configure your new report by selecting the metrics and dimensions you want in your report.

**Step-4**: Click on the ‘create report’ button to create your new report. Run the report. You will then a see report data, like the one below:

Here,

The metric ‘

’ track newsletter subscriptions.ga:goal13CompletionsThe metric ‘

ga:sessions’ track GA sessions on the website.The dimension ‘

’ track traffic source and medium.ga:sourceMedium

I selected these metrics and dimensions for my report because I want to calculate ‘*Newsletter subscriptions per session’ *for each traffic source.

**Step-5**: Now in order to calculate ‘*Newsletter subscriptions per session*’, all I need to do is to create a new column, name it ‘*Newsletter Subscriptions per session*’ and then compute this metric by using the following formula:

*ga:goal13Completions / ga:sessions*

This is how this formula is going to look like in the Google spreadsheet:

From this report we can also conclude that the metric ‘Newsletter subscriptions per session’ is really not that great metric to track and analyze in GA.

This is because, Google Analytics reporting interface show numerical values only up to 2 decimal points.

So number like ‘0.002305858444’ will be reported as ‘0.00’.

Ratio metrics are useful only when numerator and denominator are of comparable sizes which is usually not the case, esp. when you use ‘sessions’ or ‘users’ as denominator which, almost always dwarf any other GA metric which is used as numerator.

Because of this reason, ratio metrics are not very useful for analysis purpose.

For example, what useful insight you can get from ‘Newsletter subscriptions per session’ or ‘Newsletter subscriptions per user’ metric, if its value is ‘0.002305858444’…. Nothing.

Also,

**Average of an average = crap**

Ratio metrics often suffer from statistical significant issues and do not reflect ‘effect size’ as accurately as number metrics.

To make matter worse, if the set of observed values vary by a large degree, then the average (or mean) is not a good representative of all the values in the data set.

In other words, you can not trust the average then.

For example, the average of the data set {1, 20, 3} is 8 which is not a good representative of the typical value in the data set.

Hence you can not rely on this average value.

Now imagine, you take an average of this average. So what you do expect to get now, other than ‘crap’.

Now since ratio metric in itself, is not very reliable and so when you take a ratio of a ratio, you could magnify all the issues associated with a ratio metrics by several folds and can thus make ratio metrics even less reliable.

So following metrics are innately BS:

- Conversion rate per user
- Average time on page per user
- Average time on website
- Bounce rate per session

So whenever you compute calculated metrics, based on sessions (per session) or users (per users), you need to be aware of the innate issues associated with ratio metrics.

Stick to number metrics wherever, you can.

If you have to make business/marketing decisions based on ratio metrics, then also look at their composition (the size of numerator and denominator) and distribution of the values in the data set which was used to compute the average metric.

**To learn more about using the GA core reporting API, read this article: How to use Google Analytics API without any coding**

## Learn about the Google Analytics Usage Trends Tool

The Google Analytics usage trend is a new tool which is used to visualise trends in your Google Analytics data and to perform trend analysis.

Take your knowledge of Web Analytics to the next level. Checkout my **web analytics training course**.

## Take your Analytics knowledge to the next level. Checkout my Best Selling Books on Amazon

**Maths and Stats for Web Analytics and Conversion Optimization**

This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

**Master the Essentials of Email Marketing Analytics**

This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

**Attribution Modelling in Google Analytics and Beyond**

Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.