Everything You Need to Know About Google Analytics User ID

Reflective Data Google Analytics User ID

Need help?

Should you have any issues with your User-ID setup, feel free to ask for help in the comments below. One of our experts will reply in one day.

PS! Check if the question hasn’t been answered yet first.

Google Analytics, an analytics tool of choice for most of us, counts hits, page views, sessions and users.

That is clear, but did you know that users are not necessarily different users/people but could as well be the same person just using another device.

This will eventually mean that the number of users is actually less than what Google Analytics claims. You are also unable to match all of the actual visits and possible purchases that a single user has made.

Luckily, there is a feature called Google Analytics User ID.

Using User ID, you are able to unify the sessions that a single user is making using different devices, into one user in Google Analytics.

Not only does it make your user count more accurate, but it will also help you understand how people really interact with your website. Imagine someone finding your website on a mobile device, then going to a desktop to finalize a purchase.

Topics covered in this article

  • Why do you need a User ID feature?
  • Who can use the User ID feature?
  • How to set up User ID tracking?
  • How to use collected User ID-s?

What does tracking User ID give us

First and foremost, you will become able to see actual users in your reports, rather than different devices.

Imagine this scenario:

A person using a smartphone is looking for a product, they find your store and interact with it, taking a look at different products and so on. Hopefully, they like what they see.

After a few days,  they have decided to do some further research, ending up visiting your website again, this time using a tablet. Now, they really like the product and have decided to buy it.

Much like many of us, this person prefers to fill in the details etc. on their desktop device. So they grab a laptop and buy the product they found from your store, using their smartphone a few days earlier.

Without Google Analytics User ID feature you would see three different users visiting your website.

The first one is using a smartphone and is visiting many pages and products on your website.

The second user prefers a tablet and seems to be interested but then, suddenly leaves the site.

Now the third one is a perfect guy, going straight to the product and buying it like it was their job.

But that is not correct, it is actually the same person, a single user!

Using User ID you will see them as one, I think this is a pretty good reason.

Is my website eligible?

Probably all of you that don’t have the User ID feature on their website already, are now in hurry to get the feature installed.

Sadly, this feature is not for everyone. Your system must have some sort of unique ID in place already, something that would stay the same, cross device.

If your website provides a login option, you are good. If no login nor another way of identification is involved and you are not planning to add some, this feature is not for you.

Sites that almost always are eligible include e-commerce, social networks, applications, and anything with login, really.

How to set up Google Analytics User ID

As this is an extremely useful feature, enabling it takes a bit more than two clicks. But don’t worry, it’s doable.

Start by going to the Admin view in your Google Analytics account.

In the Property section, click on Tracking Info and then on User-ID. There you can enable User ID tracking.

Session Unification

While setting up User ID you will need to choose whether you want to turn Session Unification ON or OFF.

Turning it ON will make sure that all of the hits that occurred before the User ID was assigned to a user are also assigned to this user.

So, basically, it will make it possible to track what a user did before logging in, too.

Unless you have a good reason to do vice versa, turn it ON.

Google Analytics User ID Setup
Google Analytics User ID Setup

Modify your tracking code

To begin with, you need to figure out which value you are going to use as a User ID, we recommend using the same ID as does your identification system.

After you have figured out the ID, you need to pass it into a javascript variable (you might want to ask your developer’s help here)

When you have successfully passed the ID into a variable, you need to set is a User ID and send it to Google Analytics.

The easiest way to do so is to include userId attribute in your Property definition function.

ga('create', 'UA-XXXXX-Y', 'auto', {
  userId: USER_ID
});

Important!

The USER_ID value should be a unique, persistent, and non-personally identifiable string identifier that represents a user or signed-in account across devices.

In some cases, it can happen that you are not able to identify the user right away. This can happen in single page applications or with dynamic login forms.

Luckily, Google Analytics lets you set the User ID value later, too.

All you need to do is to call the following function, once the User ID is available.

ga('set', 'userId', USER_ID);

Keep in mind that in this case, all of the hits (including pageview) will not have User ID attached to them automatically, unless you have Session Unification turned ON (which you should).

User ID View

In order to view User ID data, you need to create a separate view for it.

This view is going to include ONLY the visitors that have User ID value assigned to them, so expect to see fewer users, sessions and pageviews than in your main view.

This is important because some of the calculations are done differently from the non-userID views. For example, counting the users.

You can create your User ID view at the same section where you turned ON the user ID tracking. Admin -> Property -> Tracking Info -> User ID

Give your User ID view a nice descriptive name. We recommend naming it just “User ID View”.

How to use User ID data

The very first thing you should do is to make sure that your User ID tracking is actually working.

You can do so by choosing your User ID view and checking if it has any hits.

Then navigate to the Audience section in your Reporting view and choose User Explorer.

If everything is working as it should, you can see the table where the first column is named User ID, as opposed to Client ID in your regular view. The values in that column should represent the User ID-s that you have sent to Google Analytics.

Eventually, you should see something like this:

Google Analytics User ID Success
Google Analytics User ID Success

To see how many of your users actually have User ID assigned to them VS how many don’t, switch back to your main view and navigate to Audience -> Behaviour and choose User ID Coverage report.

Now what?

Once you are sure your User ID setup tracking is actually working, switch to your User ID view and start analyzing how people in this segment behave and perform.

You can also create segments based if the user has a User ID assigned to them or not.

Most probably you will soon realize that users, that have User ID are converting better, now it’s time to figure out if it’s a correlative or causative relationship. And then if and how you could get more people into this better converting segment.

Conclusion

Google Analytics is a powerful analytics platform. But by configuring based on your actual business, you make it super-powerful.

By turning on User ID tracking you will evoke a new level of data and accuracy in your reports. Use it right and it will bring you extremely valuable insights that will eventually bring you more money.

After you have gone through and implemented what we discussed in this article, you can be sure that

  • You are properly tracking User ID-s
  • You have session unification turned ON
  • User ID view is created and showing results
  • You are one step closer to being totally data-driven

Take user analysis to a new level

Besides collection User ID data in Google Analytics, we recommend sending this, and all the other Google Analytics hits, into your data warehouse (i.e. BigQuery). One way to solve this is to use a Google Analytics Parallel Tracker from Reflective Data.

Combining Google Analytics data with other sources like CRM, CMS, ad platforms, social etc. gives you the ability to analyze the full user journey in a way that isn’t available in any tool.


This article is a part of a series called Most common Google Analytics issues (in-depth overview)

If you find something missing or misleading, please let us know in the comments.

Feel free to share this valuable information with your friends and colleagues.

154 thoughts on “Everything You Need to Know About Google Analytics User ID

  1. Pingback: [solved] Google Analytics to get employee details – Flowpoint | Blog
  2. Hi,
    I am making a dashboard on datastudio using the google analytics data. And i want to put the id users of each user on it, but i am not finding the id user there. Can i get the id user on data studio? how?

    thanks!

      1. In order to see User ID data in Data Studio (now Looker Studio) you need to first make it available in a GA custom dimension.

  3. Hi Silver,

    Thanks for this nice article. It helps me a lot in setting up the User ID View. Can I track which of my visitors successfully log in to the site and which visitors fail to log in?

    1. Hi Famina,

      Yes, but for that you need a custom event. Let’s say, with a following structure:

      • category: users
      • action: [login success / login fail]
      • label: [user id]

      Let me know if you need anything else.

      Silver

  4. Hi,

    Thanks for a great article. One challenge for us is that a user/client (a company, we run a b2b saas platform) most likely will have several users (persons) under the same umbrella.

    Should we set the UUID based on the company, so that all physical persons logging in to the same account get the same UUID, or do you think we should do something else? We are more interested to analyse behaviour on a company level than the individual users behaviour.

    We also have the opposite challenge. If a physical person who represents multiple companies comes in from say Google Ads, registers an account for company A, and then comes back the day after and registers an account for company B, would all future client actions/behaviours/revenue etc be attributed to Google Ads or would that link disappear?

    Thank you again!

    Viktor

    1. Hi Viktor,

      Good questions!

      1. Our recommendation is to have the User ID on a physical person level and use a custom dimension for account/company ID.

      2. As long as the subsequent sessions have a source of Direct (they type the URL in the address bar) they will all get attributed to Google Ads. If they’d come from search for their second session, though, it would be attributed to Organic Search.

      For this kind of more advanced use cases, we recommend sending raw GA data into BigQuery and use SQL to build the exact queries you need to analyse your data. We can help with both collecting and analyzing this type of data. http://reflectivedata.com/services/google-analytics-parallel-tracking/

  5. Hi there,
    amazing post on a quite unusual topic. Thank you for writing it.

    Last week I easily created a userId view and I was happy like a child.
    This morning something terrible happend: it seems like all the data of the last week (wed-sat) has been erased in the UserId view. No userId data, No aggregated data. Nothing. 🙁
    Data available are just from Sun to Mon (today).

    What’s happened?

    Thank you in advance for your help!

    1. If you’re absolutely certain that you didn’t delete the view then it could be that you used some form of PII (i.e. email address) as a user id?

      1. Hi, 100% sure.

        The view is still the same and no personal identifiable information has been used.
        ID is an alphanumeric code of 36 characters, totally unidentifiable.
        Also Data Rentention settings is set to standard 26 months.

        1. Okay, this is strange. I haven’t experienced something like this myself and the only thing I can think of is a bug in GA itself.

  6. Hello Silver Ringvee, how are you?

    First, I apologize for the English, I’m Brazilian, I only speak Portuguese and I’m using Google Translator to solve this doubt now.

    I’ve looked everywhere on Brazilian websites and I can’t solve a small problem with a client. Come on, please:

    I have a recurring subscription service customer who wants to review their LTV by acquisition channel. For this I suggested and implemented the userId with their system’s Google Analytics and with a direct support report from their tool (an Excel spreadsheet), I have userId information, payment date and payment amount.

    When I try to check in Google Analytics the userId acquisition source, sometimes I have more than one for the same userId and this is being a problem, because when crossing the GA data with the spreadsheet, in a Data Studio for example, I have the doubling of values ​​of some LTVs.

    Now reading the comments here, I saw that a colleague replied that the origin is linked to the session and not the user level. Could this be why I’m having this difficulty? And if so, how do you suggest I can reverse this?

    Another question to take advantage of the hook, is there any way I can send the recurring payment information directly to GA and be able to analyze it in their native reports? Because today we only get the information for the first payment, through the Purchase event.

    Thanks in advance!
    Until later,

  7. Hello — wondering if you might have a thought as to why ~5% of my users in my User ID View have a User ID status of “Unassigned”. Total users is just slightly higher than users with a User ID. Frankly, I can’t see how this is possible if, by definition, everyone in this view must have a User ID to even be present in the data set.

    Session Unification is enabled.

    It looks like pageviews for “Unassigned” User IDs are almost all hitting log in pages and forgot password pages. It makes sense they could be logged out without a User ID at such a point, but then…. they should not be in the User ID view at all! In short, I believe that 100% of Users in the User ID view should have a User ID assigned and it’s not the case and really want to know why.

    Thanks so much for any ideas 🙂

  8. Pingback: Measure Long-Term Metrics Like Customer Lifetime Value (LTV) Using Google Analytics - Reflective Data
  9. Hi! I use Google Analytics in my Intranet which has been built with sharepoint. Every employee must first login in microsoft cloud with his e-mail to use our intranet.

    And my question is, how can i set the user explorer report to show the e-mail of the employee? I can only see the user name.

    And, i would like to know if there is a way i can dowload all a list with these user id access data?

    1. Hi Diego!

      Storing e-mail address in Google Analytics is not allowed.

      Your best option would be to use something like our Google Analytics Parallel Tracking service to send GA data into a data warehouse – this allows you to collect e-mail address as well as export data in any way you like.

    1. It’s on the left sidebar, under Audience. Oh, and make sure you have a regular UA GA property, not GA4.

  10. So my understanding is you can only see User ID data in the User ID view and not in the main view, correct? I noticed that I can actually pull in the User ID as a second dimension in the Main view. I just sent a report out using the numbers I saw in the User ID view but now I’m worried they’re inaccurate. Should I be using the User ID view or the Main view? Please help!

    1. Hi Suzy,

      Sending User ID into a custom dimension is definitely a good idea and there’s nothing wrong with this setup. Data should be totally accurate unless there’s something else broken or misconfigured.

      Silver

      1. Thank you. But what I don’t understand is the numbers don’t match between the Main View and the User ID View? Everything looks the same to me. No extra filters. All I did was pull in User ID in the Main View as a secondary dimension and compare that to the number in User ID View. The 2 numbers are very different. Is there a reason why?

        1. You mean for the same user ID you’re seeing different numbers in the Main View vs User ID View? Do you have session unification turner ON?

      2. Sorry, I can’t reply to your last message so adding it here instead.

        That’s right. When I look at pageviews for the same page and user ID, the number is different between Main View and User ID view. I can’t understand why. Session unification has been turned ON too.

        Appreciate your help!

        1. Two thoughts:

          1. User ID should be sent with EVERY hit (for users that have the user ID)

          2. I recommend looking at the User Explorer report for some specific User IDs to detect which hits or other page views are not showing up in either report.

        2. Thank you for the suggestion. The User Explorer report in the Main View looks at client ID and the one in User ID view looks at user ID.

          Should I also mention that the Main View has User ID Reports disabled, where as the User ID view is enabled. But if I’m not suppose to see User ID in the Main View, why is it there for me to pull in as a second dimension? Thank you again and I apologize if I’m asking stupid questions

        3. Hey Suzy,

          Not stupid questions at all!

          – This is right, the User ID view and Main View have different groupings in the User Explorer view but you should be able to get a similar dataset if you use a custom dimension in the Main View and only include people with specific User IDs that you’re using in your debugging (to detect which hits or pageviews are missing from either view)

          – User ID reports should indeed be disabled for the Main View

          – Did you double-check that User ID is indeed passed with every single hit?

        4. My understanding is that user ID is only saved after they log into their account? Does that mean it’s being passed? Thanks again

        5. That is true. Session unification will connect hits prior to logging in with the User ID. Although, it is important to make sure User ID is passed with all hits after the user has logged in. I recommend using GA Debug Chrome extension or Developer tools Network tab to debug this.

  11. I’m looking at a website where the main CMS is WordPress and then the user is handed over to a shopify website with a the same UA ID. The part about the shopify site makes sense after to assign the user ID upon login or purchase, but I dont know if the datas further up the funnel on the WordPress site will be unified.

    1. Hi Dave,

      Can’t say for sure without knowing the exact funnel and functionality here but one feature that might be useful is Session Unification

      https://support.google.com/analytics/answer/4574780?hl=en

      Other than that, keeping a User ID unified between Shopify and WP can be tricky if they both assign their own IDs – you might find it more useful to send all data into custom dimensions instead.

  12. Is it possible to set up a view for non-logged-in visitors only?

    I have the User-ID view set up, but I’d like to compare logged-in vs. non-logged-in (currently I can just compare logged-in vs vs. all visitors, logged-in or not).

    1. Hi Parker,

      Good question. For this, I’d recommend you create a custom dimension named “logged in” where value can be “true” or “false”. Then you can create either custom segments or views based on this custom dimension. I hope this works for you!

      Cheers,
      Silver

  13. Hello great article,

    But this seems to be for the older version of Google Analytics. Do you have migration guide on how to do this for GA4?

  14. Hello Silver,

    Hope you are doing well!

    Great article..! Liked the way you have explained all the points in easiest way.

    I have recently implemented UserID view for one of my clients. But I am not able to see the transactions data under UserID view. Although it’s showing up in normal view. I am passing the IP address as User ID using GTM.
    I can see the events data as well for that IP address but transaction data isn’t showing. I have enabled the ecommerce settings in GA and have made sure that IP address fires before my pageview call. Do I need to consider anything else here or making any mistake in process? I testing with the IP address as UserID since we don’t have login function on our website. User can directly make purchase.

    Hope you can me help me out with this.

    Thanks,
    Shadab

    1. Hi Shadab,

      Thank you for your comment.

      1. Please do not use IP address as User ID even for testing as this goes against GA terms & conditions and can get your GA account terminated. A hashed version of the IP address should be fine, though.

      2. Some thoughts:
      a) Could it be that the session breaks when the user goes through the payment gateway?
      b) Is session unification turned on?
      c) Are you sending User ID with the transaction hit as well?
      d) Does attribution work correctly in other views?

      Silver

  15. Hi, nice article!

    I have User ID view now setup. I do see data similar to what you show in your screenshot. Now how do I know which specific User IDs went to a specific page? Scenario: New page deployed, who went to that page? Compare the user ID to internal User data. Did that user channel switch and contact us via another channel? In essence a Deflection.

    I can use Site content and go to that page, but User ID is not an option to add. I can go to User Explorer and see each user, but again how do I filter down to a specific page? I can go into Users Flow but then constantly drilling down trying to find the page.

    I look forward to your insight.

  16. I am often to blogging and i actually respect your content. The article has actually peaks my interest. I’m going to bookmark your website and maintain checking for brand spanking new information.

  17. Hi there,
    Great Article! I have setup User ID and I am able to see User-ID name in user explorer report with the passed on value. But I am not able to find any user id coverage report under Audience -> Behaviour / Behaviour reports.

    Why is this happening?

    1. Hi Prasanna,

      In Google Analytics UI, the only place where they expose the User ID is Audience –> User Explorer (in User ID view only). To make it more useful, we’d recommend adding a separate custom dimension for User ID (besides the native User ID dimension) – that way, you can use this dimension in most reports in both UI and via the API. Let me know if there’s something else.

  18. Hi there,
    If I visited some one’s google site (sites.google.com) and if they use a user id type analytical report to get information about visitors, will they be able to get the visitors’s email address which is a google account(for example : Joanna@gmail.com). What information do they get.
    I was under the impression that user id means they get to see a visitor’s location and their email address.

    1. Hi Shen,

      According to the terms and conditions of Google Analytics, collecting users’ email address or any other personally identifiable information is not allowed. The user ID can only be an anonymous ID.

      1. Hello Silver,

        Great article and answers, thank you very much for taking the time! My question is somewhat similar to the above. My org uses Google sites as an intranet and wants to know which users are from which department, to see the percentage of sales vs marketing vs customer support, etc.

        Is it in any way possible? I was thinking to query the GA data and compare it i.e. Workday, but am now doubtful given GA does not store user ID = email addresses. Using new google sites and GA4. Thank you so much for any insight!

        1. Hi Silver,

          Thank you so much for your response on June 15, 2021 at 2:01 pm!

          Alas, the org is using Google sites so there is no place to put a gtag.js in the header (no header in G sites), so I will explore the option of exporting the audience and matching each user ID with email -> department. If you have any documentation on that, would be super helpful. Thank you!

  19. hi silver thanks for the best post but i have doubt where i need to add

    ga(‘create’, ‘UA-XXXXX-Y’, ‘auto’, {
    userId: USER_ID
    });

    the code in my website
    and u told to add this in property definition function and what is that property definition function

    1. Hi! This depends on the type of Google Analytics installation your website has. Analytics.js, gtag.js, or Google Tag Manager?

      If it analytics.js, just add userId: USER_ID in your pageview tag (if possible). If you’re using GTM, put user ID in your Google Analytics Settings variable.

  20. Hi,

    I have a question…if I don’t have user i.d feature enabled could that stop certain channels like google ads not being attributed a sale.

    For example, using a first interaction model if a g visited your site on a work computer, then on the train way home continued browsing on their smartphone via organic search and then finally make a purchase by going directly to the website on their desktop computer at home, would that mean the google ads campaign would not get that sale attributed to it using any attribution model?

    1. Hi Tony,

      Yes, that is correct. Without a user ID, there is no way Google Analytics would know this was a same user using different devices. In your case, the sale would be attributed to the direct source (unless user had some non-direct sources from the same device earlier).

  21. Hi Silver,

    Thanks for this nice article.In my web, we have multiple routes.
    This is my scenario initialise GA with tracking I’d, send the page view and then set the user I’d. This is happening in all routes. Are we missing any page view here, if after setting the user Id user is not visiting any other routes.

    1. Hello!

      After setting a user ID, you’d have to send at least one more hit. Could be a pageview (in which case you should define the user ID before the pageview) or define the user ID with a custom event. As long as you make sure a hit is sent during or after the user ID is being set, you’re not missing any data.

  22. Hi There

    Great article, thanks.

    We have User ID installed and working correctly as you outline. We’d like to create a custom segment (or similar) of users whose FIRST PURCHASE occurred within a specified date range so that we can understand how many new users were acquired by e.g. source/medium/campaign during a given period.

    NB: in our case, every user has User ID assigned at the point of first purchase – there’s no ‘guest checkout’, account creation is mandatory pre-checkout and User ID is assigned at this point – so it’s literally impossibe for a user to make a ‘first purchase’ without first having a User ID value assigned. So we figure GA knows ‘first purchase by User ID’ – i.e. the data should definitely be there – but we can’t work out how to get GA to report it.

    Have tried various approaches to this with no success – either GA loads with no matching sessions (or fails to re-load at all in some cases) with an ‘experimental’ custom segment intended to achieve this applied. Could you pls advice how to create such a custom segment that might return ‘new users per source’ in the User ID view?

    Many thanks!

    1. Hello!

      Unfortunately, this is not doable retroactively unless you send the timestamp of the first purchase into a user-scoped custom dimension.

      For this kind of retroactive analysis, I would recommend sending all of your Google Analytics hits to BigQuery (for example with this service) – this allows for much more advanced analysis, segmentation, reporting etc.

  23. How can I get the activity by user id?
    I create the variable, but in the user-id coverage report I only see two big groups (assigned and unsigned), could I have this?

    1. I’d recommend sending the user id into a custom dimension as well (besides the native user id feature), that we you could build all kinds of custom reports and see user level data. Also, you might want to check out the Audience –> User Explorer report in GA for some user level granularity.

  24. Thanks for the explanation.

    Is it possible to generate an event with the User-ID to ga when the customer get an error or doesn’t complete a purchase?
    If so, how can you stream it in real time to external system to trigger a reaction?

    1. Hello Liran,

      It is indeed possible. If the event comes from an external system, I recommend you take a look at the Measurement Protocol. Whichever solution you go with, make sure to include both Client ID and User ID with all events you’re sending to GA.

      1. Thanks.
        Now I understand that using the measurement protocol will enable better flexibility
        generating raw events.

        But regarding the streaming, I still didn’t find a way to easily forward raw events generated by google tag manager or measurement protocol to my local Kafka for further analysis. Any insights there?

  25. Why is session unification only possible with a user id?
    E.g. if a user uses chrome on a mobile device and on desktop with its google account it would be easy for google to unify these sessions on my website without a user id.
    I.e. a more accurate count of users would be possible for google anyway, i mean also without providing the user id.

    1. I agree this would be a great feature in the eyes of all website owners, analysts etc. but unfortunately not how GA works and I don’t believe they’ll ever add this feature due to privacy and other concerns.

  26. Hi Silver, thanks for publishing this article.

    Just so I’m sure, the User ID feature can only be utilized if your site allows users to login somewhere? I had assumed initially that the User ID was automatically pinned to anyone who visits your site while logged in to their Google account.

    1. Hello Max,

      You’re right, the User ID feature makes sense only if your site has a login feature or some other form of identification (email address you could hash, for example). It does not work automatically and has to be configured manually, unless your CMS system has a feature/plugin for it.

  27. Hey
    we tried setting up a User ID view but we aren’t getting any data for a week. Also, we do not have data layer variable instead we have a 1st party cookie variable can you assist us in this case?

    1. Hello
      How are you passing the User ID value to GA? I would recommend using the 1st party cookie variable in GTM for Google Analytics Settings Variable.

  28. Hello Sliver,
    Thanks for the amazing article. It helps us a lot in setting up the User ID View. Yet, I got an issue after creating the User ID View. While checking the detailed information of a user, I can only see data of events, no data of behavior (e.g., session duration is 0, no pageviews). Do you have any idea what’s wrong here?

    1. Hello Daniel,

      User ID has to be sent with every hit. Check your browser’s network tab or GA Debug extension to make sure that User ID is sent with page views.

      1. Thanks for the reply, Sliver. The reason is that our website is a SPA(Single Page Application), we have to add User ID for every hit manually (as mentioned by you).

  29. hello Silver Ringvee, thank you for your article. I am on the right way))) We have set up user id as you see https://drive.google.com/file/d/1x-5m3uv2XjLsrSdJW4FprOkyPcuVmgZS/view?usp=drivesdk my user bought only after 2 sessions. For my case it is impossible. Regular user needs more interactions with our site than 2, and Direct (channel and source medium also evidence) that he just came with conversational goal!
    I have his corporate email(from CRM), his user id and his city (from GA). How can i find from what channel or direct page he or his colleagues have came from?

  30. My main concern is realtime of pageview and event data display same as website data view.
    but i did not get all data in behavior of userID view after waiting 48 hrs

  31. Hi,

    I had completed setup before 5 days. I have 2 view in my property. one is All Website Data and second one is USER ID View.Now I see pageview hits in realtime data. Both are same number.
    I had checked the behavior of both view then i noticed that too much difference in no of pageviews in both views.
    All web site view data show : 20000 hits
    User ID view data show : 7800 hits.

    Note : i have checked with same date before 2 days data.

    My behavior reports not updated after 48 hrs in userID view? . please help.

    Thanks and Regards
    Habib Gandhi

    1. Hello Habib,

      The real-time report doesn’t have the filters applied so it’s normal to see the same amount of traffic as in other views.

      User ID view only includes hits that came from identified sessions. So, it makes sense the number there is lower than in other views.

  32. If I have set up user id tracking, is there a way to get a view of the opposite. I want to see everyone who isn’t a user and how they are interacting on my site all the way through sign up and they stop tracking them. Is that possible?

    1. Hello Jeremy,

      What I recommend here is creating another custom dimension “login status”. Everyone with the value “false” would be people without the user-id attached to them (in most cases). You could modify the true/false rules to best match your use case. This is usually doable with GTM.

  33. Thanks Silver! I also have custom tags to track events in Google Tag Manager that appear to be functioning properly in the ‘Main’ view in Google Analytics, but are not being tracked in the User Id view (only ‘page views’ are being tracked, but not events such as clicking or video view details).

    I already followed steps to create a data layer variable for the User Id in Google Tag Manager, and also added the advised snippets to my website code, but it still doesn’t seem to work.

    Do you have any suggestions or resources?

    1. Hello Evan! In the User Id view, under Audience -> User Explorer, can you see the User Ids that you sent to Google Analytics? If not, there is something wrong with the setup.

  34. Hi Silver,

    Great article! Thank you! I have a question about: If our website doesn’t have login function and we’re passing user id via links in emails we sent to our leads. It’s good that we can identify the unique user id if they click on the links in emails across devices. But how about when they come back to the website without clicking through the links in emails we sent?

    1. Hello Sandy,

      This is an interesting case. I would recommend storing the user-id value in cookie and/or local storage and take it from there until the user opens another email link. Besides default user-id feature in Google Analytics, I suggest you send the value as a custom dimension as well, this gives you more flexibility.

  35. Dear Silver,

    Thanks for the great article! It was very helpful in the initial steps of setting up the user-id. I am an extreme beginner with this and was hoping you might be able to help me out with a few points of confusion.

    Background: I am conducting a research study in the form of an online course (using Google Course Builder). Here, I need to be able to track student-level data (e.g., time spent on each page, clicking behaviours, etc.) within the course (the students are required to register/login to participate so I think the user-id function should be fitting).

    I was able to connect the course to Google Analytics quite easily, as there is a field in Google Course Builder which asks if you would like to “input your Google Analytics ID” in order to track data.

    But when it comes to actually gathering student data in the course on the individual level, I am super confused. I used the steps you provided above, but get lost at the ‘Modify your tracking code’ step. You say that I should add the user id line of code to the ‘Property definition function’, but I am not exactly sure what that is…

    Is it the Global Site Tag?

    And if so, where does the snippet of code belong in the Global Site Tag code?
    After this, would I open up my online course and copy that paragraph of code into the html header of each page?
    As for my last question, I was wondering if I need to change the ‘USER_ID’ to something that is specific to my course?

    I am sorry in advance for so many questions and would very much appreciate any support you can provide.

    Kind Regards,
    Raven

    1. Hello Raven,

      Thank you for your questions!

      – Google Course Builder connects with Google Tag Manager. I would use the latter for all custom tracking scripts you want to implement. Then there is no need to modify your tracking code.
      – USER_ID has to be something that is unique to each logged in user, not entirely sure if/how the Course Builder exposes the user id.

      Let me know if you have any further questions on this topic.

  36. Hi Silver, thanks for this post, very interesting. I have a task to perform, so I decided to use GA USER ID, but have some confusions about that. Maybe you could help me out?
    Task is next: I need to track non registered users that could visit my site with referral links. And when user register I need to assign the LAST referral to his/her account. As I understood, USER ID is the value I can assign to user after registration. But my task is know users before registration, so I could apply them bonuses per registration depending to referral link they visited my site previously, without registration.
    Can I do this with GA USER ID you described?
    I yes, please, give some tips how.

    Thank you in advance.
    BR, Alex

    1. Hello Alex.

      First of all, I hope Google Analytics is not the only tool you are using to measure your referrals (there are tools dedicated for this that do much better job).

      If you do want to track referrals using GA, I would send the referral ID in a user-scoped custom dimension and later match it with the User ID generated by your systems. This way the custom dimension will always contain the latest referral information.

      Makes sense? Let me know if you have any further questions.

      1. Hi Silver,
        I think it makes sense for me. But a few questions for clarification.
        As I understood correctly, I can take info about user that visited my site (and not registered yet) from GA, assign SOME REF ID to it and send back to GA? So this information (SOME REF ID) will return to me next time when this user will come and register? Or I got it wrong?
        And about custom dimensions: is this GA handled area or it should be handled by me (customizing I mean)
        Sorry for a lot of questions, but never worked with GA before, and met this great article of yours.

        1. Hi Alex,

          Here’s how it should work (roughly):
          1. Go to GA admin area and create a new user-scoped custom dimension ‘REF ID’, note the new dimension index.
          2. When someone lands on your page, check if they came through a referral. If they did, send ‘REF ID’ to your custom ID index with the first page view (or with a custom event if you wish).
          3. When they sign up and receive a user ID, send that with a page view or with a custom event to GA. I recommend creating another custom dimension for user ID, too.
          4. Now, in GA you can build a custom report with dimensions user ID and REF ID to match those two values.

          That being said, I recommend storing the REF ID in a cookie or local storage and send it to your database when the user signs up, too.

  37. Hi,
    Thank you for the interesting post. I have now setup user id and I am also able to view the IDs in the regular views as custom dimension but I receive no traffic in the User ID view I have created. I hope you could help me solve this.

    Thank you!

    1. Hello Vijay,

      Besides sending User ID as custom dimension, are you also sending it to the dedicated userId dimension?

      userId: USER_ID

  38. Hi Silver – We are implementing the userid but have questions on the user id policy where it says that we must tell our users that we are now gathering this information and we must get their consent or allow them to opt out.

    Any thoughts on that?

    Janette

    1. Hello Janette,

      How are you generating the User ID? If it is the ID from your database that is used for logging in then you are already collecting it anyway and it is a system critical feature. Users who don’t allow you to collect their User ID can’t sign up or log in.

      There’s a browser add-on you visitors could use to disable data being sent to analytics https://support.google.com/analytics/answer/181881 – or you might build a similar switch yourself (using Google Tag Manager, for example).

      Does that answer your question? If not, please post a link to the policy you are referring to.

      Silver

  39. Thanks for the detailed article. Can we also build a custom report for UserID that also includes user’s utm source , medium?

  40. Pingback: Setting Up Google Analytics: Ultimate Guide To Start Measuring Success
  41. Pingback: Are Conversions The Ultimate Vanity Metric? | Kairos Media, Inc.
  42. hello
    This is so useful ,i have a question,
    Can i use userId to track my visitors who logged in in my website by their fidelity card number and know what does everyone did (clicks)?

    1. Hey Mohamed

      Sure, you can use whatever identifier you have available, exactly the same rules apply.

      For clicks, you’d likely need to use custom events, though.

      Let me know if you have any further questions.

        1. Hi Silver!

          Thanks for the advice towards Sessions ID. Through Sessions ID does it track custom events and display it in a report? Will UserID need to work with the Session ID to identify the user?
          We’re using a unique id with each user already so thought maybe attaching a UserID would generate a report, but I guess it might not be able to track each session.

          The documentation regarding Sessions ID with iOS SDK is pretty limited https://developers.google.com/analytics/devguides/collection/ios/v3/sessions

          Thank you so much for your help

  43. Hello,

    I’ve set up userID tracking with Google Tag Manager. I’ve noticed that now Google Tag Assistant shows that a new session is created each time user logs in.

    Is that how it is supposed to be? Google Analytics creates a new, separate session when we send userID?

    1. Hello Jakob,

      No, it should not create a new session. Do you have session unification turned on in the User-ID settings?

  44. Great and useful article for me!

    Currently, I am having GA with User ID.
    Next, I am planning to engage with my users with login data by signing up with simple personal information such as name, email address and phone number.

    I would like to ask, after these steps, can I know who visit my side from GA and can i interact with them like call them up or by email?

    Thanks.

    Regards,
    John

    1. Hello John

      Thank you for your question. You can definitely see which visitor did what in GA and you can call them by their name and email on your website but for the latter, you don’t really need to pull the data from GA. A simple cookie would do exactly the same.

      So, GA should be used for analytics and the rest is doable using a few lines of Javascript.

      Let me know if you have any further questions.

      Silver

  45. How much time it should take to show user-id data.
    I wanted to verify if everything has been set up correctly, I did it 3 days back but still, it is not showing.
    i have below code in google-analytics-tracking file.
    ga(‘create’, ‘UA-******-3’, ‘auto’);
    ga(‘send’, ‘pageview’);
    ga(‘create’, ‘UA-******-2’, ‘auto’, ‘gwTracker’);
    ga(‘gwTracker.send’, ‘pageview’);

    I don’t have userid here so that I am setting userid in the further code after loading JS.
    ga(‘set’, ‘userId’, ‘”.$user->id.”‘);
    ga(‘gwTracker.send’, ‘pageview’);
    Please guide me for correct implementation. Sepcially how to test runtime wheather userid is being sent or not.

    1. It’s working now. I have changed a bit my code.
      ga(‘create’, ‘UA-******-2’, ‘auto’, ‘gwTracker’,{
      userId: USER_ID
      });
      ga(‘gwTracker.send’, ‘pageview’);

      1. Hello Harpal

        I’m glad you got it fixed. What was wrong with your first snippet, though, was that you set the userId on the default tracker but sent a pageview with a custom tracker (gwTracker). So the other possible fix would have been this:

        ga(‘gwTracker.set’, ‘userId’, ‘”.$user->id.”‘);
        ga(‘gwTracker.send’, ‘pageview’);

        As GA does have some delay (up to 24 hours), it is always a good idea to test your setup using the “GA Debug” Chrome plugin, this shows you exactly what kind of data is being sent with your pageviews and other hits.

        Let me know if you have any further questions.

        Silver

  46. Silver, I appreciate your article and invite to ask further questions about User ID. I have two related questions:
    1. Can the Google ID (the persistent ID that Google uses for signed in users of their properties-apps, be tracked and assigned as the User ID and sent to Google Analytics? My understanding is that with the new Cross-Device Reporting that Google uses their persistent ID for those visitors who have registered as a Google user and assigned a persistent Google ID. And my question is using this Google ID, assigning it to User ID…creating a Custom Dimension that enables me to stitch together Client IDs into their unique User IDs (where possible)…and then download unique User IDs and unique customer journeys.
    2. Can third-party persistent IDs, such as LiveRamp’s IdentityLink (ID) be tracked (with LiveRamp’s license) and assigned as the User ID and sent to Google Analytics?

    I appreciate whatever information you can provide.

    Cheers,

    Karl Lendenmann

    1. Hello Karl and thank you for your question.

      1. It can definitely be tracked and assigned as the User ID. Otherwise, how would you connect the logged in user with your backend and database across different devices?
      2. Sure, although these ID-s are sometimes not available during the first page view as they are requested form a 3rd party server. Although, you might be able to get them from cookie value or send with a custom event once they’re available.

      Let me know if I understood your questions correctly or if you have any further questions.

      Silver

  47. This is a very good article. I have setup UserID on my website using this. Thank You. I have one question though. In Audience > User Explorer, I am only seeing client ID generated by google and not the user id i am sending for each user. I have tested with ga debugging tools that user id is being sent on each page view and also in Audience -> Behaviour -> User ID Coverage report I am seeing many users as assigned but I am not able to see their user ids in any report Any help will be appreciated.
    Thanks

    1. Hello Sahil!

      I’m glad you liked the article.

      User-ID is only available in the specific User-ID view, if you haven’t created one yet, you can do so by navigating to Admin -> Tracking Info -> User-ID.

      Let me know if that fixed it for you or if you need further help.

      Silver

  48. Pingback: Google Analytics views you should add to your setup - Reflective Data
  49. Dear Silver,

    Great post. I have one question though. I want to track user names instead of IDs, I could easily do that through custom variables but fetching this data might violate google policy and lead to termination of my account. Is there any other way of fetching this data securely?

    Thank you in advance.

    Regards,
    Isha

    1. Hello Isha,

      Sorry for the delayed reply. You are correct, storing personal information in Google Analytics is not allowed and may lead to the termination of your account.

      The best way for doing this might be storing a UID in Google Analytics and using some other tool for analysis (Microsoft BI, Tableau etc) and connecting this UID to the real username later in the tool.

      I hope this helps,

      Silver

  50. Dear Silver,

    I want to track all my users who filled my inquiry form. After filling form they will land on thank you page with userid in url. This userid is unique and randomly generated numeric code.
    After this thank you page, users sometimes visit my website. And I want to track all these customers because obviously, they are more interested than others.

    please suggest the best solution.

    1. Hey Ankit,

      As I understand, this user ID is present only once? Meaning when they visit the site again on a different device, they won’t have that same user ID again? They usually would if there’s a login feature.

      Other than that, you don’t really need the user ID feature here. I’d recommend sending a custom event once a user submits the form. Then you can use that event to create user-based custom segments in GA and see how these users behave.

      You could also send that user ID into a custom dimension and see reports for every unique user if you wanted to. Using custom reports.

      Let me know if this answers your question and feel free to ask another one.

      Best wishes,

      Silver

  51. Pingback: Why CPRU is the new metric in Performance Marketing – Exponentially - SaaS Growth And Metrics.
  52. Awesome article! First time I heard about UserIDs is your website! Loving it.

    I am trying to think of custom reports I could use for my website with this UserID feature, and Im not sure how to actually create them :blush:

    Would it be possible to create user report where I would be able to only see users with 5 or more sessions? I would then take their IDs and use the in my remarketing campaigns.

    Thanks
    Mike

    1. Hey Mike,

      Yes, you can definitely do this with custom segments in GA. Create a new segment -> Choose Behaviour tab -> set the rule “Sessions > 4”.

      Hope this was helpful. Let me know if you have any further questions.

      Silver

      1. One more thing:

        Is it possible to create a report for users that have logged in (at least once) in the last 30 days?

        Thanks a ton!!!

        1. Well, that is not doable with the default setup. You could store the “last login” date in a custom dimension every time user logs in, though. And then use that value for your custom segments.

  53. Hi, it’s possible to get data from analytic (maybe trought the API) for an specified user ID on the web site. When a customer visit my website I want to get the past analytic data of that customer to cutomize the website for him. For example… if the customer visited a product page in the past, I want to show a discount over that product on the home page.

    Thanks in advance and sorry because my poor english.

    1. You could see such data in Google Analytics reports, pulling it to the website would be an overkill, though. Why not use cookies or some personalization platform?

  54. Hi – good article! Does implementing the user-id allow you to report on conversion rate of signed in customers vs non-signed in customers? If so, how? Does “session unification” get in the way?
    Thanks!

    1. You could do so easily by storing logged-in status in a custom dimension. Then create custom segments based on that custom dimension value.

      Let me know if you have any further questions.

      Silver

      1. Silver –
        To make sure that custom dimension works well with User ID (as described in this article), should the scope of that custom dimension be hit, session, user or product? Thanks!

        PS “Silver” – Very cool name BTW!

        1. Hey Peter,

          For the sake of accuracy, I would go with the scope “session”. That’s because in a single session a visitor can be logged out and later they might log in.

          Hope this helps, let me know if you have any other questions.

          And thanks, I like my name, too 🙂

  55. Nice!
    I have one question.
    Does works with cordova google-analytics-plugin?
    Because i have this property in cordova ( $cordovaGoogleAnalytics.setUserId(“user_id_here”) )
    I’m use Ionic Framework v1.

  56. Great article! You very succinctly capture all the nuances to the hurdles of setting up User-Id. What I can’t seem to find out there is a definitive answer as to whether results tracked prior to configuring User-Id (tracked with Client ID) would eventually be connected to the User-Id. For instance: We are seeing considerably less data in the User-Id view for a given day then we are on the default all traffic view. In our case, we don’t expect users are using multiple devices. We instead suspect that the results of returning users are being grouped into the Client ID bucket, as we did not have user-id configured when they first visited.

    1. User-id view shows only the sessions that had user-id defined (usually only the logged in users). Everyone else will be excluded from that view.

      Let me know if that might be the case for you or if there has to be something else.

      Anyway, it is totally normal to see a lot smaller numbers in User-id views. Right now I am looking at one of our client’s website and the number of sessions is 700,000 vs 16,000.

      1. Thank you. I understand what you are saying, but that is not what I am asking. Let me try to say it differently: Before I configured User ID tracking, I had started collecting results in the all traffic view. Each of those results had different client IDs and were all from different people. (our environment is somewhat controlled.) Now that we have enabled user ID tracking, we would like to be able to associate the client ids tracked previously to the user, going forward. — The reason we ask is that we know we have had the same users come back, and we dont ever see them in the User-id view, however we do see brand new users. We have confirmed that for both user types that the user id is being sent in the transaction. We do have unification on.

  57. I’ve been working with Google Analytics for more than 3 years now, as a marketer though. But we never really installed User ID, although we had a discussion, will contact my developers right now. Sounds really important for any ecommerce, really. So thanks!

  58. We’ve been collecting User id for quite a long time now but I believe there must be something wrong. Only ~1% of visitors have it attached to them in Google Analytics.

    Í am quite sure that about 20% actually logged in.

    Any idea what could be off here?

    1. There can be multiple reasons here. Do you send User ID on specific pages only? Does your Javascript have an access to the value on every page you are trying to send it? It can happen that User ID is available only on user-related pages or on login-success page only, and not on the product pages etc, even if they’re actually logged in. I recommend looking into it with your developer.

      Silver

  59. Okay, now this is one really useful article, especially for me. We are just setting up User ID tracking for our ecommerce website. Thanks.

    Oh, and nice cover image 😉

    Julia

    1. Hi Julia,

      Glad you liked it. And of course, good luck with setting up the User ID tracking, feel free to ask us if you have any questions!

Leave a Reply

Your email address will not be published. Required fields are marked *

Sign up for Reflective Data

5,000 sessions / month ×

Please enter your email

Submit

After submitting your email, we will send you the registration form.