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.
CONCLUSION
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).
Why not just add the metric to the pageview trigger itself rather than creating an event & a custom metric just to record the custom metric? Btw, How is it that your Event tag does not have a Value field?
Good questions, thank you for your comment! Sure, in this example case you could add the custom metric to a Page View tag instead of an Event tag. The custom metric would be implemented in exactly the same way and have the same result. I chose to show an Event tag example though because 1) in my experience that's a much more common use case, and 2) it keeps the Page View tag clean. In this example, if you sent the custom metric with a Page View tag instead, now you'd need to either write some new trigger logic using JavaScript, or duplicate the original Page View tag and then add blog-specific triggers and exceptions to both versions, to ensure that the custom metric only gets sent on the tags on the blog pages.
I wouldn't populate the Value field since there's no measurable monetary value to someone viewing my blog. I guess I could make an estimate for it but I prefer to keep Values for something more concrete.
In Your example, you have UA firing on a specific page.. how does this work if I already have Google UA firing on all pages.
The example setup doesn't change your existing implementation at all, it just adds on an event tag. It's completely standard that UA fires on all pages, so don't change that, just add an event tag with a trigger for the page or event you're interested in.
Shouldn't there be another step to add some javascript to the site? Like pushing to the datalayer?
Nope, you don't need to use a data layer in this example, it's all done through GTM. If you were tracking something else, it could make sense, depends on what you're trying to implement. What do you have in mind?