Creating Custom Dimensions

Custom Dimensions are the equivalent to Custom Variables from the classic version of Google Analytics (GA). The main differences for most users of Custom Variables are creating Custom Dimensions prior to using them and the amount available.

Custom Dimension Limits:

  • Standard users had 5 slots/indices for Custom Variables and now have 20 slots/indices for Custom Dimensions
  • Premium users had 50 slots/indices for Custom Variables and now have 200 slots/indices for Custom Dimensions

Creating Custom Dimensions:

Contrary to Custom Variables being created and sent within GA code on a page or application, Custom Dimensions must first be created within the Admin interface of each GA property.

Process for creating Custom Dimensions in GA:
Note that your property will need to be a Universal Analytics property in order to create Custom Dimensions. If you need to migrate your property, click here <<link to the UA migration page>> to learn more about this process.

  1. Navigate to the Admin interface of the Property you would like to create Custom Dimensions in.
  2. Under the Property (middle) column click on the ‘Custom Definitions’ tab and select ‘Custom Dimensions’.
    1. If ‘Custom Dimensions’ is not an option, you will need to upgrade your property to Universal Analytics <<link ‘upgrade…Universal Analytics to the UA migration page>>
  3. Click the ‘New Custom Dimension’ button.
  4. Give your custom dimension a name.
    1. If you are transitioning from using Custom Variables to Custom Dimensions, you will likely want to use the same naming convention for Custom Dimensions.
  5. Give your Custom Dimension a scope. Your options for scope are:3
    1. Hit – In Google Analytics, Custom Dimensions are sent along with other hit types, including pageviews, events, or ecommerce tracking calls. If the scope is set to ‘Hit’ the Custom Dimension value will only be applied for the hit it was attached to.
    2. Session – A scope of ‘Session’ applies the Custom Dimension values to all hits of a user’s session, regardless of when the Custom Dimension occurred within the session. For example, if the fourth hit of a session included a Custom Dimension value with a Session level scope, the Custom Dimension value will be attached to all preceding and future hits within that session.
    3. User – User scoped Custom Dimensions are very similar to Session scoped Custom Dimensions; however, with User scoped Custom Dimensions all future session hits of the user will also contain the Custom Dimension value.
      1. It is important to note that User scoped Custom Dimensions will only apply to the current and future sessions. Historical user sessions will not be reprocessed to include the Custom Dimension value, even if it is set to a User scope.

Deploying Custom Dimensions:

There are two methods for deploying Custom Dimensions on your website:

  1. The set command. Using the set command to record Custom Dimensions in Universal Analytics will append the Custom Dimension value to every hit on the page, after the set command has been called. The proper syntax for the set command is below. Note that you only need to include the index of the Custom Dimension (dimensionX) and the value (value) you want to send. The Custom Dimension index will correspond to the index number of the Custom Dimension name in the GA admin interface you are sending values to, so an index of 4 would be ‘dimension4’.  The name and the scope of the Custom Dimension will be processed on the backend of GA, based on your created Custom Dimensions.
    //code block
    ga(‘set’, ‘dimensionX’, value);
  2. The send command. Custom Dimensions sent via the send command are directly attached to a corresponding hit, such as a pageview or an event. Unlike the set command, the send command will only apply the Custom Dimension to the hits on a page that include Custom Dimension information. For example, if you want to send a Custom Dimension when someone performs a specific event, the send command for the event would look like the following, where as before dimensionX corresponds to your Custom Dimension index and value is the value being sent for the Custom Dimension:
    //code block
    ga(‘send’, ‘event’, ‘eventCategory’, ‘eventAction’, {‘dimensionX’: value});