Dimension Widening in Universal Analytics

(You are reading part 1 of a three-post series on Dimension Widening USE-CASE. We also recommend you to read parts 2 & part 3 in the series)

When carrying out analysis, it is important to look at many datasets to get the 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 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 a 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 at it from the customers’ viewpoint. 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 the conversion rate and Avg. Order Value or other metrics from viewpoint when during the day, customers access the website & of course, all our customers are 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 to using custom dimensions in Universal Analytics.

Dimension widening steps
    1. 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 a session because we want to know the hour of every visitor’s session.


  1. Pass the custom dimension value for Visit_hour from the website using custom tracking
    • Paste the JavaScript code of the 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 running 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 a custom dimension value (Visit_hour).
  2. 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 the 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.
  3. Upload the data set
    • Go to Admin -> Property -> Data import.
    • Create a New Data set and select the 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 creating a new view for any new dimension widening
    • Select the key as the Visit_hour from the custom dimensions list
    • Select the Widen to Dimension & Metrics  as Time_period from the 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 been uploaded without any errors, you have to wait for the next few hours till the data processing is complete.


  4. 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 the Average visit duration of the visitors during a particular time period of the day. It shows that our website has the 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 a 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 a 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 cases 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)

, , , ,
Previous Post
Is There A Hole In Your Bucket? Churn analysis for Mobile App
Next Post
How to carry out lead gen form Analysis using Google Analytics?

2 Comments. Leave new

  • Avatar
    Артём Кулбасов
    May 30, 2014 9:48 am

    Parameter name “dimension5” in the code may be different for each user Universal Analytics, isn’t it?

    • Avatar
      May 30, 2014 12:04 pm

      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.


Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed