Every report in Google Analytics contains dimensions and metrics. Dimensions describe the data, and metrics measure them.
Custom metrics let you measure additional items beyond the default measurements like "sessions" and "total events". It's easy to overlook them because it's often possible to get similar results in other ways (e.g. events + goals), but custom metrics provide a lot more flexibility when it comes to reporting. This post will walk through a complete example of setting up a custom metric using Google Tag Manager, and show an example of how they simplify reporting.
STEP 1: CREATE THE CUSTOM METRIC IN GOOGLE ANALYTICS
Custom metrics are set up at Admin > Property > Custom Definitions > Custom Metrics >+New Custom Metric
Give the metric a name and choose the scope. There are only 2 options for scope: hit and product. Product scope refers to e-commerce related metrics like price or profit margin, while hit will be used for everything else. In this example I'll create a custom metric to count views of this blog, so I am choosing Scope = Hit.
You will also need to choose a Formatting Type, with options of Integer, Currency, and Time. Here we'll choose Integer.
STEP 2: NOTE THE INDEX NUMBER
GA will automatically assign an index number for each custom metric. Note that index number as we'll need it later. Here the index number was automatically assigned as 3.
STEP 3: ATTACH THE METRIC TO A TAG IN GTM
Custom metrics must be sent alongside other hits, for example pageviews, events, or ecommerce hits. So to set custom metrics, you need to attach them to a relevant tag.
In this example, I'm creating a metric to count blog views, so I created a new event in GTM to track blog views. The event was set up as normal, with custom metrics values set under 'Enable override settings in this tag' > More Settings > Custom Metrics. Make sure the index number matches the number provided by GA in step 2.
The Metric Value is how much the value should increment each time it fires. If you're counting things, as in this example, it will usually be 1. If you're instead measuring a price or other value, you'd probably set that value into a variable and use that instead.
The event will track blog views by itself, via the default event metrics. Adding a custom metric to the event just provides additional convenient reporting options, which we'll look at in a minute.
STEP 4: SET A TRIGGER AND PUBLISH
In this case, a trigger type of Page Path contains /blog/ will work.
STEP 5: SETUP COMPLETE - REVIEW THE DATA
Now that setup is complete, wait for some data to come in. Here I'll compare the difference between using the default total events metric vs. the new custom metric.
Default event tracking shows the event dimensions on the left, with the total events and unique events metrics on the right.
You can also associate these events with other dimensions like marketing sources:
However, this type of view will filter for events containing your action. What if you want to compare total sessions for each marketing source vs. sessions that triggered the event (i.e. a 'viewed blog' conversion rate)? You can't do this with just event tracking since there's no "null" event.
One method is to put the event into a goal, and then track it that way. That works fine, with some drawbacks: goal names are a bit long and messy, aren't retroactive, only get incremented once per session per goal, and are limited to 20 per view for standard GA.
Another method is to create a custom report using the new custom metric:
Now we can see overall sessions alongside viewed blog counts, something that wasn't available in the event tracking report.
Custom metrics enable some very convenient reporting options, even if you're already tracking the same data with an event. Setup is very easy, so it's generally a good practice to add custom metrics for each of your events, at least up to the maximum of 20 custom metrics (200 for Premium accounts).