Custom Metrics let you collect metrics in Google Analytics that are specific to your business. This can be the number of ads that loaded on a page, the bandwidth that the page consumed when it loaded, or the total number of brand pageviews that each of your marketing channels leads to.
For example, the Google Merchandise Store is in a big push to sell Android-branded merchandise and wants to know which marketing channels are contributing to Android merchandise pageviews. They can include tracking code on Android merchandise pages that fires with each pageview hit and increments a Custom Metric in Google Analytics.
To set up a Custom Metric, go into Admin. Select the Property in which you want the metric applied. Then click “Custom Definitions” and “Custom Metrics.” Then click “New Custom Metric.”.
You first have to name the Custom Metric. Then you have to define its scope. This is based on how this metric data will be generated. Unlike dimensions, Custom Metrics can only have a scope of “hit,” or “product.”
- If you select “hit,” the Custom Metric will be incremented with each hit sent over by the tracking code and totalled up in Google Analytics.
- If you select “Product,” the Custom Metric can increment by whatever cost you assign to the product. We’ll select “hit,” since we want the Custom Metric sent over with each pageview hit of Android merchandise pages.
Next, we’ll need to specify the format of the Custom Metric. You can select a basic integer, a decimal value, or a time-based value. Since we want to total up pageviews, we can send a basic integer of “one” with each hit. This will then increment the Custom Metric in Google Analytics by “one” each time a pageview hit fires.
You can also specify minimum and maximum values that determine whether Analytics will process this metric and include it in your reports. This can help prevent accidental large or small values from being collected and affecting your reporting. Since we know we don’t want our range to exceed 1, we can set a minimum value of 0 and a maximum value of 2.
Note the default checkbox to make the metric active. You can make Custom Metrics inactive at any time by unchecking this box. Any Custom Metric data already collected and processed will appear in reports, but no data will be collected once the metric has been made inactive. To save the Custom Metric, click “Create.”
You’ll be taken to an overview screen where you can see all of the Custom Metrics that you have set up in the property. Notice that, similar to “Goals” and “Custom Dimensions,” Google Analytics assigns an index (or slot number) for each Custom Metric you create. Notice that you cannot choose which index number is assigned; they are assigned in the order you created them.
When a user performs an action like landing on an Android-branded merchandise page, the code will send over a hit and increment this metric in Analytics using the index for that Custom Metric.
When planning out Custom Metrics, there are a few things to keep in mind. Think about how you want those metrics to appear in your reports. You can send Custom Metrics with a particular value for every hit on a page or you can manually specify different values for individual hits.
If you use Custom Metrics in conjunction with a session-level dimension such as “source / medium,” think about which specific hits will cause the Custom Metric to increase. If you only expect a Custom Metric to increase once per session, you’ll want to design your data collection accordingly.
Note that similar to Custom Dimensions, you won’t be able to apply a Custom Metric to data you have previously collected. If you want to make it easier to manage the Custom Metric tracking code on multiple pages of your website, check out the Google Tag Manager course on Analytics Academy.