Depending on whether you are using the free or 360 version of Google Analytics you get 20 or 200 custom dimensions and metrics to work with.
When used correctly, these custom definitions can be one of the most useful custom features in Google Analytics. They allow you to tailor your analytics to meet your needs and to match your KPIs.
One of the most common problems related to custom definitions has been that people don’t know what exactly are the dimensions and metrics they should be tracking.
Out of the box, Google Analytics already tracks a few hundred different dimensions and metrics. In this article, we are giving you a few ideas for the custom ones you might want to add to your list.
While the main idea behind custom dimensions is to allow you track more specific things that might not be relevant to every website owner, there are some in this article that I would recommend adding to every Google Analytics setup. (Bookmark this post for your next GA setup)
Custom Dimensions
Client ID
Scope: Session
Every instance of the _ga
cookie gets a unique Client ID, which is how the Google Analytics backend knows that the same visitor has visited the site multiple times. This Client ID is not exposed in any dimension you can query via the API.
There are multiple ways to access the Client ID of the current visitor, but the most intuitive solution is by using GTM and customTask.
Depending on your setup, you might try accessing the Google Analytics object directly ga.getAll()[0].get('clientId');
User ID
Scope: User
The User ID feature in Universal Analytics groups together hits, sessions, and Client IDs. It is the highest possible level of abstraction and aggregation available in Google Analytics.
User ID value is generally available for logged in users only and usually coming from your back-end/CMS. Besides tracking User ID using a custom dimension, you should also configure Google Analytics built-in User ID feature.
Session ID
Scope: Session
In Google Analytics, all hits are grouped together into sessions. However, using the API or custom reports alone, you will not be able to identify if two distinct hits belong to the same session.
A Session ID is a random string generated using Javascript and it should be sent with every page view. The string changes with each page view, but it doesn’t really matter as you’re sending it to a session-scoped Custom Dimension, only the last value you send will be applied to the hits in the session.
While there are multiple solutions for creating a random string using Javascript, I am generally using something like this var session_id = new Date().getTime() + '.' + Math.random().toString(36).substring(5);
Timestamp
Scope: Hit
Unfortunately, you can’t query for the exact timestamp of a Google Analytics hit using the API. Neither can you get it in your custom reports. However, this might be very meaningful information, especially if you want to verify data integrity across systems.
Login Status
Scope: Hit
It is highly likely that users who have logged in behave differently to those who never logged in. Setting it up is fairly simple, for example, you could use GTM to check the value of a Javascript variable or look for an element that’s only visible to logged in users (i.e “My account” button in the header) and populate your dimension accordingly.
User Agent
Scope: Hit
User Agent can help you in many ways – detecting bots, debugging etc. Unfortunately, Google Analytics doesn’t give you the user agent dimension out of the box. Tracking it using custom dimensions is really simple, the user agent is stored in a Javascript variable navigator.userAgent
.
Page Type
Scope: Hit
Although, you should be using Google Analytics’ Content Grouping for a similar purpose, having it in custom dimension has its advantages. For example, your page types could be home, category, product, checkout, confirmation, blog, webinar.
A/B Testing Variant
Scope: Session
While this might sound obvious to some, many novice A/B testers rely solely on the data displayed by the testing tool they’re using. Having a second source for double-checking is absolutely a must, besides, it allows for a more granular analysis that most A/B testing tools don’t allow.
reCAPTCHA Score
Scope: Session
Google Analytics does have a simple bot-filtering system in place but it comes nowhere near catching all the bots that visit your site. Even tools like reCAPTCHA by Google can’t usually say for sure whether a visitor is a bot or a human but they can give you a score (from 0.1 to 1). Simo Ahava has put together a great tutorial for tracking the reCAPTCHA both score using Google Analytics custom dimensions.
Custom Metrics
Tracking User Actions
Scope: Hit
Normally, you would track user actions using custom events. This is great but sometimes you need more context, more flexibility, just like you have with Google Analytics’ built-in metrics. That is why I’d recommend tracking your most important user actions using custom metrics, and with custom events, too.
Some actions you might want to track using custom metrics:
- Add to Cart
- Add to Wishlist
- Clicked Recommended Product
- Submitted Rating Form
- Posted a Comment
- Made a Reservation
You get the point. I recommend starting with your top 3-5 most important user actions.
More on this with some examples on Analytics Ninja’s blog.
Pricing
Scope: Hit
Google Analytics already tracks revenue (considering you have implemented (enhanced) ecommerce tracking). Now, to get a better context and allow for some further analysis on your financial strategies, consider adding these custom metrics.
- Displayed Price ($160.97)
- Original / Full Price ($190)
- Product Level Discount ($29.03)
Based on this data, you could build reports like this
Social Media Shares
Scope: Hit
Capturing social shares can give you a good insight into what content users find interesting and willing to share with their audience. Using this metric, you can compare content marketing efforts and see how well your social campaigns are doing. Capturing social shares gives you an idea of the type of content and types of the audience interested in your content so you can build niches or on top of previous success and increase your reach and look to grow your user base.
Time on Site
Scope: Hit
Formatting Type: Time
There are several ways you can track time on site in Google Analytics. The default solution isn’t accurate because it only counts until the last hit. This means that sessions with only one hit have a duration of 0.
Using custom metrics, you can define your own rules. One of the best solutions we’ve seen is tracking the amount of time the browser tab is active. This requires sending an event at an interval, for example, every 10 or 15 seconds.
To make this metric even more useful, you can build different calculated metrics combining time on site with other metrics. For example, time on site per session.
This allows you to build useful custom reports like this one.
Conclusion
Custom metrics and dimensions are key to customizing your Google Analytics setup to meet the needs of your business. I recommend taking some time, thinking through your whole business logic, reading this article (and a few similar ones) once more and decide which custom metrics and dimensions would make sense the most.
Implementing most of them require some Javascript development experience and knowing how Google Analytics works would be really useful, too. In case this looks overwhelming, I strongly recommend hiring an expert.
Also, if we missed an important metric or dimension, let us know in the comments below.
How to read custom dimensions/metrics for ex: in our case we are displaying ‘CUSTOMER NUMBER” AND “PART NUMBER”, How to get the dimension or metrics to access through reporting api.
Hi Prashant,
Custom dimensions are accessible just like any other dimension using the Reporting API. i.e. as opposed to
ga:pagePath
you would usega:dimension1
. That works for you?I find myself coming back to this blog post every time I’m working with a new Google Analytics setup. This is the best list of custom dimensions to set up that I’ve found so far. Thanks!
Thank you Sarah!
By the way, we are constantly updating this blog post as we come up with new cool and useful custom dimensions.