Custom Dimensions and Metrics
Key Concepts of Custom Dimensions and Metrics
google analytics automatically collects a long list of built-in dimensions but we can create specific dimensions
Custom Dimensions and metrics are property level configurations and when created, will appear under all views under the property.
They are only available under universal analytics, or android and IOS property setups.
Free version: 20 custom dimensions/metrics per property
Paid version: 200 slots available for custom dimensions/ 200 metrics
You cant not delete custom metrics or dimensions, only disable them or edit them.
Scope
- scope determines to what level they will be applied
- four levels scope are available for custom dimension and metrics
- hi: only applies to certain hit such as page-view or event
- session: applies to all hits within a session
- users: applies to all hits generated by user
- Products: (applies to enhance eCommerce tracing only); applies to all hits that contains product data
After adding a custom dimension or metric, GA allocate an index number to it
The index number will be used later for data collection
To collect data into custom dimension, use following syntax:
ga(‘set’,'<custom dimension index>’,'<value>’);
For example, right before pageview hit, you can run the following command to identify user login status:
ga(‘set,’dimension1′,’notlogged-in’);
To collect data in a custom metric, use following syntax:
ga(‘set,'<custom metric index>’,'<value>’);
For example, right before an event hit, run the following command to collect
users rating for a content:
ga(‘set’,’metric1′,’3 out of 5′);
There is no command to directly collect custom dimensions or metrics through command queue and data is always being collected attached to one of the hits types.
For example, you can collect user login status as apart of a pageview hit
to collect data into custom dimension, use the following syntax:
ga(‘set’,'<custom dimension index>’,'<value>’);
For example, right before pageview hit, you can run the following command to collect user login status:
ga(‘set’,’dimension1′,’not logged-in’);
Custom dimensions and metrics can be used similar to default dimensions and metrics in any report. You can only cross correlate custom dimension and metrics on the same scope that are on the same level.