What is a dimension in Google Analytics?

A dimension is the attribute of visitors to your website.

For example, let us suppose 27,379 people visited your website via Google organic search in the last one month.

Now all these 27,379 people who visited your website have one common characteristic /attribute. They all visited your website via Google organic search (which is reported as google/organic in Google Analytics).

As a result ‘google / organic’ is one of the attributes of your 27,379 website visitors.

Google Analytics reports the attribute of visitors to your website as a dimension:

Each dimension is made up of names and values.

For example, ‘Source/Medium‘ is the dimension name and ‘google/organic‘ is dimension value.

Let us suppose 247 people visited your website via Google paid search in the last one month.

Now all these 247 people who visited your website have one common characteristic /attribute. They all visited your website via Google paid search (which is reported as google/cpc in Google Analytics).

As a result ‘google / cpc’ is one of the attributes of your 247 website visitors and is reported as a dimension in GA:

Since each dimension is made up of names and values, so ‘Source/Medium‘ is the dimension name and ‘google/organic‘ and ‘google/cpc‘ are dimension values.

A single dimension like ‘Source/Medium’ can have a lot of values:

Another example

Let’s say a man aged between 25-34 from London visited your website after clicking on an organic search listing on Google which he found by searching for the keyword ‘attribution modelling’.

Let us also assume that he visited your website via a Chrome browser which is installed on a desktop computer that runs Windows.

Now following are the attributes of the visitor to your website along with their values:

Gender – male

Age – 25-34

City – London

Source / Medium – Google / Organic

Keyword – Attribution Modelling

Browser – Chrome

Device Category – desktop

Operating System – Windows

Here, ‘Gender’, ‘Age’, ‘City’, ‘Source /Medium’, ‘Keyword’, ‘Browser’, ‘Device Category’ and ‘Operating System’ are all reported as dimensions in Google Analytics because they are the characteristics of your website users:

Different types of dimensions in Google Analytics

The dimensions in Google Analytics can be broadly classified into two categories:

Default Dimensions – the dimensions that are already available in Google Analytics reports. Custom Dimensions – these are user-defined dimensions.

Note: Both default dimensions and custom dimensions can be used as primary dimensions or secondary dimensions in GA reports.

Different categories of default dimensions in Google Analytics

Following are the various categories of default dimensions in Google Analytics:

#1 User Dimensions – For example User Type, Count of Sessions, Days Since Last Session, Customer Lifetime Value, etc.

#2 Session Dimensions – For example, Session Duration, Session Count.

#3 Traffic Sources Dimensions – Campaign, Source, Medium, Source / Medium, Keyword, etc.

#4 Adwords (Google Ads) Dimensions – Google Ads Campaign ID, Google Ads Ad Group ID, Query Match Type, Placement Domain, Placement URL, etc.

#5 Goal Conversions Dimensions – Goal Completion Location, Goal Previous Step – 1, Goal Previous Step – 2, etc.

#6 Platform or Device Dimensions – Browser, Operating System, Device Category, Mobile Device Model, etc.

#7 Geo Network Dimensions – Continent, Sub Continent, Country, Region, City, etc

#8 System Dimensions – Screen Resolution, Java Support, Flash Version, etc

#9 Page Tracking Dimensions – Landing Page, Page, Exit Page, Previous Page, Page path level 1, Page path level 2, etc

#10 Internal Search Dimensions – Site Search Status, Search Term, Site Search Category, Start Page, Destination Page, etc

#11 App Tracking Dimensions – App Name, App ID, Screen Name, Landing Screen, Exit Screen, etc

#12 Event Tracking Dimensions – Event Category, Event Action, Event Label

#13 Ecommerce Dimensions – Transaction ID, Product SKU, Product, Product Category, Product Category (Enhanced Ecommerce), Shopping Stage, etc.

#14 Social Interactions Dimensions – Social Network, Social Action, Social Type, etc

#15 User Timings Dimensions – Timing Category, Timing Label, Timing Variable

#16 Exceptions Dimensions – Exception Description

#17 Content Experiments Dimensions – Experiment ID, Variant, Experiment ID with Variant, Experiment Name

#18 Custom Variables or Columns Dimensions – Custom Dimension XX, Custom Variable (Key XX), Custom Variable (Value XX)

#19 Time Dimensions – Date, Year, Month of the year, Day of the month, Hour, Minute, Hour of Day, etc

#20 DoubleClick Campaign Manager Dimensions – CM Ad (GA Model), CM Advertiser (GA Model), CM Campaign (GA Model), CM Ad, etc

#21 Audience Dimensions – Age, Gender, Affinity Category (reach), In-Market Segment, etc

#22 DoubleClick for Publishers Backfill Dimensions – GAM Line Item Id, GAM Line Item Name

#23 Lifetime Value and Cohorts Dimensions – Acquisition Channel, Acquisition Campaign, Acquisition Source, Acquisition Medium, etc

#24 Channel Grouping Dimensions – Default Channel Grouping

#25 DoubleClick Bid Manager Dimensions – DV360 Advertiser (GA Model), DV360 Exchange, DV360 Insertion Order, DV360 Site ID, etc

#26 DoubleClick Search Dimensions – SA360 Campaign, SA360 Ad Group, SA360 Keyword, SA360 Agency, SA360 Advertiser ID, etc

Note: To see the complete list of all the default dimensions available in Google Analytics along with their description and usage, check the Dimensions & Metrics Explorer.

What are default dimensions?

Default dimensions are the dimensions that are already available in Google Analytics reports. They are ready to use dimensions.

The following are examples of default dimensions:

Gender

Age

City

Source / Medium

Keyword

Browser

Device Category

Operating System

What are custom dimensions?

Custom dimensions are user-defined dimensions.

If you want to measure the characteristic of a user that can not be measured by any default dimension then you need to create and use your own dimension to measure such characteristics.

For example, you can create your own dimension to determine and store keywords which resulted in a phone call on your website.

Similarly, you can create your own dimension to retrieve website usage data by authors, logged in or logged out users or create your own dimension to measure conversion data and time in Google Analytics.

Through custom dimensions you can import the data which google analytics does not automatically collect (like CRM data, phone call data, logged in users data, etc) and correlate this non-google analytics data with Google Analytics data.

What are primary dimensions?

A primary dimension is the default dimension applied to a report in Google Analytics.

When you navigate to a report say ‘Channels’ report then the default dimension that you see being applied to the report is the primary dimension:

Here the primary dimension is the ‘Default Channel grouping’.

How to change the primary dimension in a Google Analytics report

Google Analytics lists all the available primary dimensions at the top of the data table in a report:

To change the primary dimension just click on one of the primary dimensions.

For example, if you click on the ‘Source / Medium‘ primary dimension then your data table is going to look like the one below:

If you don’t see your primary dimension being listed at the top of the data table then click on the ‘Other’ drop-down menu:

Click on the ‘Commonly Used’ drop-down menu to see the list of commonly used dimensions:

Now click on the dimension you want to apply to your data table.

If you still can’t find your dimension then there are three things that you can do:

#1 Click on the drop-down menus listed under the ‘More Dimensions’ section one by one and then find your dimension:

For example, you can click on the ‘Acquisition’ drop-down menu:

#2 Click on the checkbox ‘Display as alphabetical list‘.

This will list all the available dimensions for your data table in the alphabetical order:

#3 Use the search box to find your dimension.

If you already know the name of your dimension then you can simply search for it:

What are secondary dimensions?

The second dimension that you apply to a report is called a secondary dimension.

In order to apply a secondary dimension to a report click on the ‘Secondary dimension‘ button:

You should now see a drop-down menu from which you can select your secondary dimension:

Let’s apply a secondary dimension called ‘Country’ to our ‘Channels’ report:

Now the data table would look like the one below:

Note: You can use custom dimensions as primary dimensions in custom reports or as a secondary dimension in standard reports but you can not use custom dimensions as primary dimensions in standard reports.

How to include more than two dimensions in your Google Analytics Reports

By default, you can add only two dimensions to a GA report at a time: one primary dimension and one secondary dimension.

But if you want to include more than 2 dimensions in your GA reports then follow the steps below:

Step-1: Navigate to main reporting view of your Google Analytics account and then click on the ‘+ New Custom Report’ button:

Step-2: Click on the ‘Flat Table’ button:

Step-3: Click on the ‘+add dimension’ button:

Step-4: Select the dimension you want to add to your custom report:

Step-5: Repeat Step-3 and 4 to add more dimensions. You can add up to five dimensions to your custom report:

Step-6: Click on the ‘+add metric’ button:

Step-7: Select the metric you want to add to your custom report:

Step-8: Repeat Step-6 and 7 to add more metrics to your reports.

Step-9: Click on the ‘Save’ button to save your custom report.

You should now be able to see the five dimensions added to your custom report like the one below:

This can help you in doing more meaningful analysis.

Note: You can also use custom dimensions as a custom segment in GA reports.

How dimensions and metrics are reported in Google Analytics

Google Analytics (GA) reports contain two types of data: dimensions and metrics.

GA displays data in its reports, usually in the form of a table (called the data table). Each row of the table represents the value of a dimension and each column represents the value of a metric:

Every Google Analytics report is made up of dimensions and metrics.

What is a metric in Google Analytics?

A metric is a number that is used to measure one of the characteristics of a dimension.

A dimension can have one or more characteristics.

For example, the following are the characteristics of the dimension called ‘Source / Medium’:

Sessions % New Sessions New Users Bounce Rate Pages / Sessions Avg. Session Duration Goal Conversion Rate Goal Completions Goal Value

Here Sessions, % New Sessions, New Users, Bounce Rate, Pages / Sessions, etc are all reported as metrics in Google Analytics because they are the characteristics of the dimension called ‘Source / Medium’.

Differences between dimensions and metrics in Google Analytics

Difference #1

Though both dimensions and metrics are the characteristics of your website visitors, they are different in the way they are: configured, collected, processed, reported, and queried in Google Analytics.

For example, you can’t use (or query) dimension as a metric or metric as a dimension in Google Analytics either via the reporting interface or via API.

Difference #2

In Google Analytics, a dimension provides context to a metric. Consequently, a standalone metric is meaningless to analyze and report.

For example, the metric ‘sessions’ is meaningless on its own and makes sense only when used together with a dimension like ‘source/medium’, ‘user type’, ‘country’ etc.

Difference #3

Unlike dimensions, metrics are reported under the following three categories in Google Analytics:

Acquisition – how visitors arrive at your website Behavior – how visitors interacted with your website Conversions – how visitors completed conversions on your website.

Examples of Acquisition Metrics:

Sessions % New Sessions New Users

Examples of Behavior Metrics

Bounce Rate Pages/Sessions Avg. Session Duration

Examples of Conversion Metrics

Goal Conversion Rate Goal Completions Goal Value

Difference #4

Unlike dimensions, not all metrics can appear in every Google Analytics reports. For example ‘page value’ metric appears in only certain Google Analytics reports.

This is because Google Analytics uses different analytics attribution models to produce a certain set of reports or to produce a certain set of metrics.

These analytics attribution models are:

Per GIF request attribution model – This model is used to calculate aggregate values for a metric.

– This model is used to calculate aggregate values for a metric. Page value attribution model (or forward-looking attribution model ) – This model is used to calculate the ‘page value’ metric for a page or set of pages.

(or ) – This model is used to calculate the ‘page value’ metric for a page or set of pages. Site search attribution model – This model is used to calculate Goal value and Goal conversion rate for each search term.

Difference #5

A dimension can have any of the following scopes: ‘Hit’, ‘Session’, ‘User’ or ‘Product’.

Whereas a metric can have only two scopes, either ‘Hit’ or ‘Product’ (more about scopes later).

Difference #6

The value of a dimension is of type ‘text’. Whereas the value of a metric is of type ‘integer’.

Custom dimension properties / configuration values

Every custom dimension in GA has got the following five properties (also known as configuration values):

Name Index Scope Last Changed State

Name is the name of the custom dimension as it will appear in your Google Analytics reports. Use a descriptive and unique name so that you can easily identify and understand the functionality of your custom dimension.

Index (also known as a slot) is a number (must be a positive integer) which is used to internally identify and differentiate one custom dimension from another in Google Analytics. The index is like a parking space reserved for your custom dimension. Once an index is used, it can not be used for another custom dimension. The value of the index should be between 1 and 200.

Scope determines the hits that will be associated with the value of a custom dimension.

Last Changed is the date when a custom dimension was first created or last modified.

State is the current status of a custom dimension. It can be either ‘active’ or ‘inactive’.

Note: Inactive custom dimensions may continue to appear in your GA reports but you will not see any new values being reported.

Custom dimension scope

Each custom dimension can have any of the following four scopes:

Hit Session User Product

Custom Dimension – ‘Hit’ Scope

A hit is a user’s interaction with your website/app that results in data being sent to the Google Analytics server.

Following are the examples of some common hits:

Pageviews

Screenviews

Events

Transactions

A user can send one or more hits.

The value of a custom dimension is sent along with a hit. So if a custom dimension has been set up, then a user hit is sent along with the value of the custom dimension. Otherwise, the hit is sent without the value of the custom dimension.

When a user hit is sent along with the value of custom dimension and the custom dimension has got hit level scope, then the value of custom dimension is only applied to the hit with which the value was sent.

In other words, the value of the custom dimension is calculated and send for each hit.

Custom Dimension – ‘Session’ Scope

A session is a group of hits recorded for a user in a given time period.

A user can trigger one or more sessions on the same day or over the course of multiple days, weeks or months. By default, a session expires after 30 minutes of users’ inactivity on your website or at midnight or if the user returns to your website via a different campaign.

When a custom dimension has got session-level scope, its value is applied to all the hits in a current session.

In other words, the value of the custom dimension is calculated and send only once per session.

To learn more about sessions in Google Analytics, check out this article: Understanding sessions in Google Analytics.

Custom Dimension – ‘User’ Scope

A user is a random unique client ID set by Google Analytics cookie when a browser (like Chrome, Internet Explorer, Safari, etc) loads your website content for the first time.

Every time a new client ID is detected in a session, Google Analytics count it is as a new user.

Every time an existing client ID is detected in a new session, Google Analytics counts it as a returning user.

Since a client ID exists only on the device (desktop, laptop, mobile, tablet) and the browser where it has been set, Google Analytics can not identify a user across devices and browsers.

When a custom dimension has got user-level scope, its value is applied to all the hits in the current session as well as future sessions of a user, until there is a change in the value of custom dimension or custom dimension has been made inactive.

In other words, the value of a custom dimension is calculated and send only once per user.

To learn more about users in Google Analytics, check out this article: Understanding users in Google Analytics.

Custom Dimension – ‘Product’ Scope

A product represents the product you sell on your website.

When a custom dimension has got product level scope, its value is applied to the product for which it has been set. In other words, the value of the custom dimension is calculated and send only once per product.

Product level scope can be set for custom dimensions only when you have implemented enhanced ecommerce tracking on the website.

In short, scope determines when the value of a custom dimension should be calculated and send.

#1 if a custom dimension has got hit scope, then the value of custom dimension should be calculated and send for each hit or for the hit with which the value is sent.

#2 if a custom dimension has got session scope, then the value of the custom dimension should be calculated and send only once per session.

#3 if a custom dimension has got user scope, then the value of custom dimension should be calculated and send only once per user.

#4 if a custom dimension has got product scope, then the value of custom dimension should be calculated and send only once per product.

Classification of dimensions in terms of scope

Google Analytics dimensions can be classified into the following four categories, in terms of scope:

Hit level dimensions Session level dimensions User level dimensions Product level dimensions

#1 ‘Hit’ Level Dimension

It is the dimension that has got hit level scope. A hit level dimension can be predefined or custom.

Following are the examples of predefined hit level dimensions:

Page

Page Title

Page Path Level 1

Landing Page

Search Term

Event Category

Event Action

Event Label

Use a hit level custom dimension when:

#1 You want to associate the custom dimension value only with the hit with which it was sent

#2 The dimension value change for each hit.

In the case of the hit level custom dimension, the value of the custom dimension is calculated and send for each hit.

For example, here is how you can send the value of a hit level custom dimension with a pageview hit:

For Analytics.js

ga(‘send’, ‘pageview’, { ‘dimension1′: dimensionValue’}); // Dimension value is sent for each hit

In the above code, dimension1 is an index (each custom dimension has an index associated with it) and dimension value is a variable.

Let’s suppose you use a PHP website and store the actual value of a dimension in a php variable.

For example, you may store Page Type in a php variable as <?=$page_type?>.

So whatever value PHP variable holds it, will be passed to dimension1

With this example, the actual code may look like below

ga(‘send’, ‘pageview’, { ‘dimension1’: <?=$page_type?>});

For gtag.js:

You need to use custom_map parameter to send data to Google Analytics. Following is the syntax:

gtag(‘config’, ‘UA-XXXX-12’, {

‘custom_map’: {‘dimension<Index>’: ‘dimension_name’} // Dimension value is sent for each hit

});

// Send the value of custom dimension to Google Analytics.

gtag(‘event’, ‘page_view’, {‘dimension_name’: dimension_value});

Note: Replace ‘UA-XXXX-12’ with your Google Analytics tracking ID

The actual code may look like the one below:

gtag(‘config’, ‘UA-XXXX-12’, {

‘custom_map’: {‘dimension1’: ‘page_type’} // Dimension value is sent for each hit

});

// Send the value of custom dimension to Google Analytics.

gtag(‘event’, ‘page_view’, {‘page_type’: Home});

Here is how you can send the value of a hit level custom dimension with an event hit:

For Analytics.js

ga(‘send’, ‘event’, ‘category’, ‘action’,{ ‘dimension1′: dimensionValue’}); // Dimension value is sent for each hit

The actual code may look like the one below:

ga(‘send’, ‘event’, ‘category’,’action’,{

‘dimension5’: ‘<?=$userID?>’

});

In the above code <?=$userID?> refers to a PHP variable which contains user ID values like 1253483232

For gtag.js

gtag(‘config’, ‘UA-XXXX-12’, {

‘custom_map’: {‘dimension<Index>’: ‘dimension_name’}

});

// Send the value of the custom dimension to Google Analytics.

gtag(‘event’, ‘any_event_name’, {‘dimension_name’: dimension_value});

The actual code may look like below

gtag(‘config’, ‘UA-XXXX-12’, {

‘custom_map’: {‘dimension15’: ‘internal_campaign_name’}

});

// Send the value of the custom dimension to Google Analytics.

gtag(‘event’, ‘campaign_link_click’, {‘internal_campaign_name’: ‘Home Page Promo Offer’});

If you want to send the value of a custom dimension with all the hits on a page then use the set command:

For Analytics.js

ga(‘set’, ‘dimension1’, dimensionValue);

The actual code may look like the one below:

ga(‘set’, ‘dimension1’, userID);

For gtag.js

gtag(‘set’, {

‘custom_map’: {

‘dimension1’: ‘dimension name’

}

});

gtag(‘config’, ‘UA-XXXX-12’, { ‘dimension name’: ‘dimension value’ });

The actual code may look like the one below:

gtag(‘set’, {

‘custom_map’: {

‘dimension1’: ‘logged in state’

}

});

gtag(‘config’, ‘UA-XXXX-12’, { ‘logged in state’: ‘not logged in’ });

#2 ‘Session’ Level Dimension

It is the dimension that has got session level scope. A Session level dimension can be predefined or custom.

Following are the examples of predefined session level dimensions:

Source / medium

Source

Medium

Keyword

Query

Use a session level custom dimension when:

#1 You want to associate the custom dimension value with all the hits of a current session

#2 The dimension value doesn’t change often for each hit.

In the case of session level custom dimension, the value of the custom dimension is calculated and send only once per session.

For example, here is how you can send the value of a session level custom dimension with a pageview hit:

For Analytics.js

ga(‘set’, ‘dimension1’, dimensionValue); // Dimension value should be sent only once per session

ga(‘send’, ‘pageview’);

For gtag.js:

gtag(‘set’, {

‘custom_map’: {

‘dimension1’: ‘dimension name’

}

});

gtag(‘config’, ‘UA-XXXX-12’, { ‘dimension name’: ‘dimension value’ });

Note: Make sure to replace ‘UA-XXXX-12’ with your Google Analytics tracking ID

Here is how you can send the value of a session level custom dimension with an event hit:

For Analytics.js

ga(‘set’, ‘dimension1’, dimensionValue); // Dimension value should be sent only once per session

setTimeout(“ga(‘send’,’event’,’Profitable Engagement’,’time on page more than 3 minutes’)”,180000);

Note: Session level custom dimensions can be set at any time during a session.

For gtag.js:

gtag(‘set’, {

‘custom_map’: {

‘dimension1’: ‘dimension name’

}

});

setTimeout(“gtag(‘event’, ‘Profitable Engagement‘, {‘event_label’:’more than 3 minutes‘})”,180000 );

#3 ‘User’ Level Dimension

This is the dimension with user level scope. A user level dimension can be predefined or custom.

Following are the examples of predefined user level dimensions:

Age

Gender

Affinity category

In-Market segment

Country

Region

City

Use a user level custom dimension when:

#1 You want to associate the custom dimension value with all the hits of current and future sessions of a user.

#2 The dimension value doesn’t change often for a particular user until there is a change in the value of custom dimension or custom dimension has been made inactive.

In the case of a user level custom dimension, the value of the custom dimension is calculated and send only once per user.

For example, here is how you can send the value of a user level custom dimension with a pageview hit:

For Analytics.js

// Dimension value should be sent only once per user

ga(‘set’, ‘dimension1’, dimensionValue);

ga(‘send’, ‘pageview’);

For gtag.js:

gtag(‘set’, {

‘custom_map’: {

‘dimension1’: ‘dimension name’

}

});

gtag(‘config’, ‘UA-XXXX-12’, { ‘dimension name’: ‘dimension value’ });

Here is how you can send the value of a user level custom dimension with an event hit:

For Analytics.js

// Dimension value should be sent only once per user

ga(‘set’, ‘dimension1’, dimensionValue);

setTimeout(“ga(‘send’,’event’,’Profitable Engagement’,’time on page more than 3 minutes’)”,180000);

For gtag.js:

gtag(‘set’, {

‘custom_map’: {

‘dimension1’: ‘dimension name’

}

});

setTimeout(“gtag(‘event’, ‘Profitable Engagement‘, {‘event_label’:’more than 3 minutes‘})”,180000 );

#4 ‘Product’ Level Dimension

It is the dimension that has got product level scope. A Product level dimension can be predefined or custom.

Following are the examples of predefined product level dimensions:

Product

Product SKU

Product Category (Enhanced Ecommerce)

Product Brand

Transaction ID

Product list name

Product list position

Use a product level custom dimension when:

#1 You want to associate the custom dimension value with a particular product.

#2 The dimension value change for each product.

For example product name change with each product.

In the case of a product level custom dimension, the value of the custom dimension is calculated and send only once per product.

You can send the value of a Product level custom dimension only with enhanced ecommerce product data.

For example, here is how you can send the value of a Product level custom dimension with enhanced ecommerce product data:

For Analytics.js

For gtag.js:

Predefined and custom metrics

Predefined (system-defined) metrics are the metrics which are already available to you in the Google Analytics reports. They are ready to use metrics.

Custom metrics are user defined metrics. We use custom metrics when we need to measure the characteristics of a dimension (whether predefined or custom dimensions) which cannot be measured by any predefined metrics

For example, if you have defined the keywords which resulted in a phone call as a custom dimension in GA then one of the characteristics of this dimension could be ‘number of phone calls generated by each keyword’.

You can measure the number of phone calls by creating and using a custom metric (say ‘Phone Calls’). The whole setup could look something like the one below:

Through custom metrics, you can import the data which google analytics does not automatically collect (like CRM data, phone call data, logged in users data, etc) and correlate this data with Google Analytics data.

You can use custom metrics with both predefined dimensions and custom dimensions. Google Analytics provides more than 200 predefined dimensions and metrics. Get the entire list.

Custom metric properties / configuration values

Every custom metric in GA has got the following eight properties or configuration values:

Name Index Scope Formatting type Last changed State Minimum value Maximum value

Name is the name of the custom metric as it will appear in your Google Analytics reports. Use a descriptive and unique name so that you can easily identify and understand the functionality of your custom metric.

Index (also known as a slot) is a number (a positive integer) which is used to internally identify and differentiate one custom metric from another in Google Analytics. It is like a parking space reserved for your custom metric. You can not use the same index for two or more metrics. The value of the index should be between 1 and 200.

Scope determines the hits that will be associated with the value of a custom metric.

Formatting Type determines how the value of a custom metric should be displayed in reports. Formatting type can be: Integer, Currency (decimal) or Time:

An integer is a whole number.

Currency is a decimal number.

Time is number of seconds (but it appears as HH:MM:SS in your GA reports)



Last Changed is the date when a custom metric was first created or last modified.

State is the current status of a custom metric. It can be either ‘active’ or ‘inactive’.

Note: Inactive custom metrics may continue to appear in your GA reports but you will not see any new value in the reports.

Minimum value is the minimum value of a custom metric that should be processed and reported in your GA reports.

Maximum value is the maximum value of a custom metric that should be processed and reported in your GA reports.

Custom metrics scope

Each custom metric can have any of the following two scopes:

Hit Product

Custom Metric – ‘Hit’ Scope

When a custom metric has got hit level scope, then the value of a custom metric is only applied to the hit with which the value was sent.

In other words, the value of a custom metric is calculated and send for each hit.

Custom Metric – ‘Product’ Scope

When a custom metric has got product level scope, its value is applied to the product for which it has been set.

Product level scope can be set for custom metrics only when you have implemented enhanced ecommerce tracking on the website.

Classification of metrics in terms of scope

Google Analytics metrics can be classified into the following two categories, in terms of scope:

#1 Hit Level Metrics

#2 Product Level Metrics

#1 Hit Level Metrics

This is a metric that has got hit level scope. A hit level metric can be predefined or custom.

Following are the examples of predefined hit level metrics:

Sessions

Percentage of new sessions

Bounce rate

Avg. session duration

Use a hit level custom metric when:

#1 You want to associate the custom metric value only with the hit with which it was sent

#2 The metric value change with each hit.

In the case of a hit level custom metric, the value of the custom metric is calculated and send for each hit.

For example, here is how you can send the value of a hit level custom metric with a pageview hit:

For Analytics.js

ga(‘send’, ‘pageview’, { ‘metric1′: metricValue’}); // Dimension value is sent for each hit

For gtag.js:

gtag(‘config’, ‘UA-XXXX-12’, {

‘custom_map’: {‘metric<Index>’: ‘metric_name’}

});

// Send the value of custom dimension to Google Analytics.

gtag(‘event’, ‘pageview’, {‘metric_name’: metric_value});

Here is how you can send the value of a hit level custom metric with an event hit:

For Analytics.js

ga(‘send’, ‘event’, ‘category’, ‘action’,{ ‘metric1′: metricValue’}); // Dimension value is sent for each hit

For gtag.js:

gtag(‘config’, ‘UA-XXXX-12’, {

‘custom_map’: {‘metric<Index>’: ‘metric_name’}

});

// Send the value of custom dimension to Google Analytics.

gtag(‘event’, ‘any event name’, {‘metric_name’: metric_value});

If you want to send the value of a custom metric with all the hits on a page then use the ‘set’ command:

For Analytics.js

ga(‘set’, ‘metric1’, metricValue);

For gtag.js:

gtag(‘set’, {

‘custom_map’: {

‘metric1’: ‘metric name’

}

});

gtag(‘config’, ‘UA-XXXX-12’, { ‘metric name’: ‘metric value’ });

#2 Product Level Metrics

This is a metric that has got product level scope. A product level metric can be predefined or custom.

Following are the examples of predefined product level metrics:

Product revenue

Unique purchases

Quantity

Average price

Product refund amount

Use a product level custom metric when:

#1 You want to associate the custom metric value with a particular product

#2 The metric value change for each product. For example ‘product colour’ often changes with each product.

In the case of the product level custom metric, the value of a custom metric is calculated and send only once per product.

You can send the value of a product level custom metric only with enhanced ecommerce product data. For example, here is how you can send the value of a product level custom metric with product data:

For Analytics.js

For gtag.js:

Dimension – metric combinations

Not all dimensions and metrics can be queried/used together.

Only those dimensions and metrics can be used/queried together which have got the same scope. Therefore we can have valid and invalid dimension-metric combinations.

Example of valid dimension-metric combination: ‘user type’ and ‘users’ Example of invalid dimension-metric combination: ‘source’ and ‘users’

‘user type’ and ‘users’ is a valid dimension-metric combination because both the dimension and metric have got the same user level scope.

‘source’ and ‘users’ is an invalid dimension-metric combination because both the dimension and metric have got a different scope.

The dimension ‘source’ has got session level scope whereas the metric ‘users’ has user level scope.

Similarly, ‘page’ and ‘users’ is an invalid dimension-metric combination because the dimension ‘page’ has got hit level scope whereas the metric ‘users’ has got user level scope. Get a complete list of valid dimension-metric combinations

Note: Hit level scope is also known as ‘action’ level scope.

Setting up custom dimensions and metrics

Important points to remember before you set up custom dimensions and/or metrics:

#1 Custom dimensions and metrics can be set up only in Universal Analytics and not in classic Google Analytics.

#2 In classic Google Analytics we use custom variables instead of custom dimensions.

#3 Both custom dimensions and custom metrics are set at the property level and not at a view level.

#4 You can create up to 20 custom dimensions and 20 custom metrics per property in Universal Analytics.

#5 If you are using Google Analytics Premium (GA 360) then you can create up to 200 custom dimensions and 200 custom metrics per property.

#6 Once you have set up a custom dimension or custom metric in your GA property, you can’t delete it. However, you can edit it.

#7 You can disable a custom dimension or metric by unchecking the ‘Active’ checkbox:

#8 Google recommends not to re-use/edit (i.e. change name, scope, etc) a custom dimension or custom metric as it can create data integrity issues that can’t be easily fixed. So set up custom dimensions/metrics after proper thought and planning.

#9 The values of custom dimensions (with hit, session, or user scope) and custom metrics (with hit scope) are sent to Google Analytics as parameters attached to other hits (like page views, events, etc).

Consequently, values of custom dimensions and custom metrics can’t be sent after a hit has already been sent.

So, the following code won’t send the value of custom dimension to Google Analytics:

ga(‘create’, ‘UA-1235-12’, ‘auto’);

ga(‘send’, ‘pageview’);

ga(‘set’, ‘dimension1’, ‘Value 1’);

The code below will send the value of custom dimension to GA:

ga(‘create’, ‘UA-1235-12’, ‘auto’);

ga(‘set’, ‘dimension1’, ‘Value 1’);

ga(‘send’, ‘pageview’);

Similarly, the following code won’t send the value of custom metric to Google Analytics:

ga(‘create’, ‘UA-1235-12’, ‘auto’);

ga(‘send’, ‘pageview’);

ga(‘set’, ‘metric1’, ‘Value 1’);

The code below will send the value of custom metric to GA:

ga(‘create’, ‘UA-1235-12’, ‘auto’);

ga(‘set’, ‘metric1’, ‘Value 1’);

ga(‘send’, ‘pageview’);

In case of gtag.js, custom dimensions and custom metrics are already configured in the Event call and can be sent only after Event fires.

#10 The values of custom dimensions and custom metrics with product level scope are sent to Google Analytics as parameters attached to product data.

Consequently, values of custom dimensions and custom metrics can’t be sent after the product data has already been sent.

Deleting a custom dimension or custom metric

Once you have set up a custom dimension or custom metric in your GA property, you cannot delete it. However, you can edit it or disable it.

Google recommends not to re-use or edit (i.e. change the name or scope etc.) a custom dimension or metric as it can create data integrity issues which cannot easily be fixed. So only set up a custom dimension or metric after careful thought and planning.

Setting up a custom dimension using Google Tag Manager

If you use Google Tag Manager, you can send values to the custom dimension using a variable that pulls data from your web page or data layer.

Note: You have to set up a custom dimension in Google Analytics first.

Follow the steps below:

Step-1: Login to Google Tag Manager

Step-2: Navigate to the ‘Tags’ tab:

Step-3: Edit the Google Analytics tag:

Step-4: You will see a window like the one below. Click on the checkbox ‘Enable overriding settings in this tag’:

Step-5: Click on ‘More Settings’ and then click on ‘Custom Dimension’:

Step-6: In the ‘Index’ field enter your custom dimension index number (e.g. 1) and in the ‘Dimension Value’ field select the variable (from the drop-down menu) whose value you would like to pass in Google Analytics:

In this case, we are passing the value of the variable {{Page category}} to custom dimension 1.

Values in the {{Page category}} variable (like ‘home’, product category page’, product page’, etc.) will be assigned to custom dimension 1

Similarly, you can set up custom metrics using Google Tag Manager.

Follow steps 1 to 3 above then do the following:

Step-4: Click on ‘More Settings’ and then click on ‘Custom Metrics’

Step-5: In the ‘Index’ field enter your custom metric index number (e.g. 1) and in ‘Metric Value’ field select the variable whose value you would like to pass in Google Analytics:

In this case, we are passing the value of the variable {{User Age}} to custom metric 1.

Values in the {{User Age}} variable (like ‘32’,’58’, ‘69’, etc.) will be assigned to custom metric 1

Step-6: Click ‘Save’ and ‘Publish’.

Note: You can check and validate in Google Tag Manager debug console what values are being passed to custom dimensions and metrics:

As you can see, Metric1 is assigned the value of Datalayer variable “User Age”.

And if you click on the ‘Variables’ tab in the debug console, you can see that User age is 58:

Similarly, you can see that dimension1 is assigned the value of the DataLayer variable “Page Category” and the value of the variable ‘Page Category’ is ‘Home’.

Six stages of custom dimensions and metrics setup

There are six stages of creating and using custom dimensions and metrics in GA. They are:

#1 Planning – at this stage you create a road map of exactly how you will collect the data and send it to Google Analytics via custom dimensions/metrics.

#2 Configuration – at this stage custom dimensions and metrics are defined via Google Analytics property settings or GTM container tag settings.

#3 Collection – at this stage you collect the required data (like values of custom dimensions or metrics) from your implementation and then send it to Google Analytics server.

#4 Processing – at this stage GA server process the collected data according to their configuration values (like scope) and reporting view filters.

#5 Reporting – at this stage the processed data become available in the GA reports.

#6 Querying – at this stage a GA user can query the data either via the reporting interface or via the GA API.

I have explained all of these stages along with examples in great detail in the article: How to correctly measure conversion date and time in Google Analytics.

Frequently Asked Questions about dimensions and metrics

What is a dimension in Google Analytics? A dimension is the attribute of visitors to your website. Google Analytics displays data in its reports, usually in the form of a table. Each row of the table represents a dimension.

What are predefined and custom dimensions? Dimensions which are already available in Google Analytics reports are called Predefined dimensions. These are ready to use dimensions. If you want to measure the characteristic of a user which can not be measured by any predefined dimension then you need to create and use your own dimension to measure such characteristics. Such dimensions are called 'Custom dimensions'.

What is a metric in Google Analytics? Google Analytics displays data in its reports, usually in the form of a table. Each column of the table represents a metric. A metric is a number that is used to measure one of the characteristics of a dimension. A dimension can have one or more characteristics.

What are predefined and custom metrics? Metrics which are already available in Google Analytics reports are called Predefined metrics. These are ready to use metrics. If you want to measure the characteristic of a dimension (whether predefined or custom dimension) which cannot be measured by any predefined metric then you need to create and use your own metric to measure such characteristics.

What are the differences between a dimension and metric in Google Analytics? Though both dimensions and metrics are the characteristics of your website visitors, they are different in the way they are: configured, collected, processed, reported and queried in Google Analytics. For example, you can’t use (or query) dimension as a metric or metric as a dimension in Google Analytics either via the reporting interface or via API.

How to classify dimensions in terms of scope? Google Analytics dimensions can be classified into following four categories, in terms of scope: 1) Hit Level Dimensions 2) Session Level Dimensions 3) User Level Dimensions 4) Product Level Dimensions.

Further reading