How to include non-standard data from WCM to GA

Overview

Default reports in Google Analytics don't automatically collect specific data from a site. Custom dimensions allow you to view additional data points or pieces of information alongside GA’s default hits.

This article describes how to create custom dimensions and the process of it.

Custom dimensions are essentially custom secondary dimensions that are configured through your GA settings. There’s a section within secondary dimensions solely dedicated to custom dimensions, once enabled. Here’s an example of a standard secondary dimension pulled into a GA report:


As commented custom dimensions allow to have extra information of your site available on GA. In this specific case, we're interested in collect data from WCM, for example, content author, user id or user role. This information is available on a page of the site but we also can find this information in the page source, in a dataLayer, URL or GTM variable into GTM  variable into your GA.


Custom dimensions are made up of the following elements:

  1. Index: the identifying number for your values
  2. Values: the specified data that’s sent
  3. Scopes: the type of value that’s collected
  4. Variables: what collects your value in GTM

How to set up a Custom Dimension through Google Tag Manager

  1. Log in to your Google Analytics account
  2. Navigate to Admin > Property Settings > Custom dimensions in your Google Analytics account
  3. Add a custom dimension. Define dimension's name, specify scope type and make sure 'Active' is checked.

    Note

    If you are not familiarized with scope definition, please click here to have more context of scope custom dimensions.

    Important

    Take note of the dimension number. GA will create a custom tracking code for those settings.

  4. Log in to your Google Tag Manager account
  5. Create your variable in GTM. The type of the variable created will vary depending on where the information is located.
    1. A part of the URL parameter
    2. a dataLayer variable
    3. A custom Js variable
    4. Default GTM variable
      1. For example, in the KFC site, we need to have user id available in each user hit. The user-id value is exposed on the page in an object. So, a custom javascript variable is created and access to this object to get userId value and return it.
  6. Set the field name and value in your GA variable. Your Ga property must be tracked through a Universal Analytics in GTM to set up custom dimension with this method. 
  7. Set the index and value under Custom Dimensions. Set the index to the number you noted from step 3. Then, set the same variable that is returning the value.
  8. Validate in preview mode you are getting values for all custom dimensions created. 

Note

Use any of the tools described in this article.