(You are reading part 1 of a three post series on Dimension Widening USE-CASE. We also recommend you to read part 2 & part 3 in the series)
When carrying out analysis, it is important to look at many datasets to get right perspective. For e.g. if you are selling winter clothes & doing conversion rate analysis, it is vital to consider weather data. In general, we always faced limitations in Google Analytics to import any external data.
There is a good news now! GA now offers this fantastic functionality called “Dimension Widening” where we can import external data.
With this new feature you can include data from external sources in your Google Analytics custom reports. This way you can combine the data of a dimension that is available in GA with the external data which you can import. You can have one primary key from GA (e.g. let’s say visitor ID) & you can have its data imported from your CRM into the GA. The data can be uploaded in form of CSV either manually or using API. However, it is very important to understand that Dimension Widening cannot be applied to historical data.
While working with an interesting client, we have developed a use case to provide an overview on which type of data you can use for dimension widening. Now let’s check out one use case for it.
Objective of use case
Conventional google analytics gives you great data on when user visits your website & when it converts. However, the “HOUR” variable that you see is with respect to the settings that you’ve established in your GA view configuration. This doesn’t take into account the timezone factor.
When we look at the data this way, we are not looking it from customers view point. i.e. your data can tell you that most people visit your website at 10 AM but you don’t know whether that was morning for a customer or an afternoon?
We were trying to identify when during “their” day (of a visitor), they are likely to access the website rather than the server time when they access the website.
The entire objective was to look at conversion rate, Avg. Order Value or other metrics from view point when during the day, customers access the website & of course, all our customers spread across multiple time zones.
Since it is very early on this feature, it is not possible to widen all different dimensions so we resorted using custom dimension in Universal Analytics.
Dimension widening steps
-
- Create custom dimension in Universal Analytics
- Go to Admin -> Property -> Custom Definitions -> Custom Dimensions.
- Create two new custom dimensions with meaningful names, for example Visit_hour and Time_period. Define the scope of the dimension as “Session”. We are defining the scope as session because we want to know the hour of every visitor’s session.
- Create custom dimension in Universal Analytics
- Pass the custom dimension value for Visit_hour from the website using custom tracking
- Paste the JavaScript code of custom dimension before the Universal Analytics pageview call.
var dimensionValue = new Date().getHours(); ga ('set', 'dimension5', dimensionValue); ga ('send', 'pageview');
- We use the above JavaScript date function to extract the actual time from the visitor’s system. This function when runs on the client’s machine will give the correct time of the user. For example, if a visit has started at 16:23, then the hour value 16 is set as custom dimension value (Visit_hour).
- Create a data set
- Create a CSV with two columns using the naming conventions provided by Google Analytics. For Visit_hour the dimension name is ga:dimension4 and for Time_period its ga:dimension5
- The first column of Visit_hour dimension will contain the value from 0 to 23 as the hours of the day. The second column is the Time_period of the day. For example,if the hour of the day is between 6 AM to 12 PM , then the Time_period is considered as Morning
- You can download the dataset for this use case from here. Change the CSV header with the header names given in GA.
- Upload the data set
- Go to Admin -> Property -> Data import.
- Create a New Data set and select Generic dimension widening option from the list
- Give a meaningful name to the dataset and select a view. As we know, the widened data cannot be un-widened, we recommend to create a new view for any new dimension widening
- Select the key as the Visit_hour from custom dimensions list
- Select the Widen to Dimension & Metrics as Time_period from custom dimensions list
- Download the data set Schema and save the data set.
- Click on Manage uploads and then upload your CSV.
- Once your data has uploaded without any errors, you have to wait for next few hours till the data processing is complete.
- View data in Custom Reports
- Here, we can see a custom report by using the widened data. For example, below report shows the city with time-period and number of visits.
- Below is the other report where we have Average visit duration of the visitors during a particular time-period of the day. It shows that our website has most number of visits during the noon time and people spent more time on the website in the morning. That’s interesting !
Based on my experience, there are few points that require consideration before using dimension widening. Here is the quick checklist which will be useful.
Checklist for Dimension Widening
- The Dimension widening is not applicable to Historical data. So it is only for the new data. Make sure that you let your boss know about it 🙂
- Data once widened for any view cannot be undone. So before you upload the full dataset, create a test view in your web property to use Dimension widening.
- Dimension widening is not allowed for all the dimensions in Google Analytics (I wish that will change over period of time!). For example, you cannot widen your data using:
- Campaign dimensions
- Time based dimensions
- Product dimensions and metrics
- Custom variables
- Geographical dimensions
This is one of the use case we’ve created using dimension widening. Read our second USE-CASE of Dimension Widening where we show you How to integrate your SEO data into GA (Part 2 in the series)

Yaman Patel

Latest posts by Yaman Patel (see all)
- Web & App Measurement in a Single Google Analytics Property with the all-new User Unification Update - September 9, 2019
- Implement dataLayer and Google Tag Manager: Best Practices and Advantages - January 13, 2018
- JavaScript error tracking in Google Analytics via Google Tag Manager: The unsung hero - June 5, 2017
2 Comments. Leave new
Parameter name “dimension5” in the code may be different for each user Universal Analytics, isn’t it?
Yes, Parameter name “dimension5” in the code will be different for each Universal Analytics user. The “dimension5” is the name of the custom dimension which is provided by UA when you create a new custom dimension.