How to add custom User-ID to your Universal Analytics (Google) implementation?


There are three different implementations that you could have with Google Analytics:

  1. Classic Google Analytics
  2. Universal analytics
  3. Universal analytics with Google Tag manager.

If you fall under “2. Universal analytics” then this post is for you since I’ll walk you through steps that you need to take see UserID’s on your google analytics report.

First why do you want UserID on your GA reports? 

1) Data blending is powerful. If you can combine your transactional datasets with web traffic data then you can extract some powerful insights! To be able to join your transactions data with web traffic data, you need some field that is common across those datasets. UserID might be one of the most useful fields that you could use for data blending.

2) Also having UserID in your reports let’s you perform some user behavior analysis at individual level and that could be pretty powerful too!

Now, How?

There are three steps:

  1. Identify the User ID
  2. Create a Custom Dimension on Google Analytics
  3. Modify your tracking code to send data for the custom dimension

Step 1. Identify the User ID

The first step is to identify the ID that you are going to send to Google analytics. Remember that you can’t send PII (personally identifiable information) so you can’t send something like an email id but you can send other ID’s that may be used in your database.

Step 2: Create a custom dimension on Google Analytics

Go to google analytics admin section > Select your account & property > Go to Custom dimensions

Custom dimensions google analytics

Now, create a new custom dimension. Give it a name, scope it and make sure it’s marked active.

Custom dimension universal analytics User ID

Step 3: Modify your tracking code to send data for the custom dimension

Notice that once you create the dimension, it will also show the example code (on the right side in the picture above). Send this to your web developer!

Just a note on this: The custom dimensions for which you are passing value using the tracking code are referenced as dimensionxx and you don’t use the Name like “Custom User ID” — if it’s the first custom dimension that you will refer to it as dimension1 in the code.

Next steps: Let me know if you have any further questions and if you are interested in seeing the steps for classic GA and Universal analytics w/ Google Tag manager then here’s a blog for you:

I hope this was helpful!

What do you think? Leave a comment below.