I have just started working on a platform where all the users are known and signed-in.

We plan to find out the roles of all of our users so we can begin customising the experience and I was thinking it would also be useful to be able to use these roles as segments in Google Analytics.

How would I go about setting this up so that Google Analytics knows user's roles? My initial thought was that we would have to drop a cookie when the user logs in.

  • Is the assumption that you're using Google Tag Manager correct? (If so it would be good to tag your question with google-tag-manager as well as google-analytics.)
    – Reve
    Sep 6, 2018 at 17:03

1 Answer 1


You can add this information to Google Analytics as a Custom Dimension. First, create the Custom Dimension.

  1. Navigate to Admin Property: Custom Definitions Custom Dimensions.
  2. Click +New Custom Dimension.
  3. Input “Name” as e.g. User Type. Set “Scope” as User. Ensure that “Active” is checked.
  4. Click Create.
  5. You will get a dimension Index number when you look at the list of your Custom Dimensions. Record this number.

Then, create a data layer variable:

  1. With your CMS, add the data layer to your pages where the information on “user type” will be added to the data layer.
  2. In Google Tag Manager, create a new Variable that will read the value of the data layer variable “user type”

The final step is to enable a custom dimension in your Google Analytics Settings variable that you apply to your Google Analytics tags.

  1. Click Variables and then click on your Google Analytics Settings variable.
  2. Click Variable Configuration.
  3. Click More settings Custom Dimensions.
  4. Click +Add Custom Dimension.
  5. Enter the Index value that you captured when you created the new Custom Dimension.
  6. For Dimension Value, enter the name of the variable that you created, e.g. “user type”.
  7. Click Save.
  8. Publish your container for the changes to take effect.

After this you can use the new Custom Dimension to create new segments in Google Analytics based on what type of user is logged into your platform.

  • Thanks for your long answer but would that just say if a user was logged in or not? All of our users are logged in. What I want to do is create segments based on whether that user is a Sys Admin, 1st Line Support, CIO etc. We don't have that information yet but we will start gathering t in the next few weeks. I don't know how to make that information available to analytics.
    – R Reveley
    Aug 30, 2018 at 8:47
  • Sure, @RReveley, this is not a problem, I've amended the instructions so that the new dimension you will create is for "user type", not "user status". Aug 31, 2018 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.