Complete Guide to User Id in Google Analytics

“Digital marketing is nothing but an online simulation of the offline marketing”.
After a long history of having offline marketing rule the entire concept of enticing customers, we have now started going digital. Thus, we might have sessions and cookies in Digital Marketing but in real lives we have users coming and interacting with your brand. Thus comes the concept of user ids where the ids are somewhat like names given to people who come and interact with your brand.
The User ID lets you associate engagement data from multiple devices and different sessions with unique IDs.
In GA the sessions are a collection of interactions during a defined period of time from a user. By default, this time period is set to 30 minutes. Thus if a user is inactive for 30 minutes, a new session is created. This limit for 30 minutes is apt for most businesses but if your business have content such that a user might stay active for a session without doing any interactions you could increase the session length. This might be the case if there is a video whose length is more than 30 minutes and a user might be viewing the video and thus might remain inactive for a long time. You could re-configure this to more or less than 30 minutes if you might want so.
In real world, the users interact multiple times before they make a macro conversion for your brand, eg: buying your product for an ecommerce website. Since that happens over many sessions, there is dire need to collate the engagement data over these sessions to understand the user behavior.
In GA we have the option to set random user ids automatically. The User ID is set at the property level. To find a property, click Admin, then select an account and a property. From theProperty column, click Tracking Info then User ID.
Follow the step-by-step flow. Click the blue buttons to complete an action and move on to the Next step. After you complete a step, you can click edit at any time to revise your selections.
In GA the user ids are device ids. These device ids don’t change untill the user clears his/her cookies or deletes and reinstalls your mobile application. Google by default gives different ids to different devices even if the same user uses both devices to interact with your website.
You can overwrite the user ids given by GA and use your own user ids to make data much more accurate and solve the cross-device tracking.
How??you might be thinking. It is much simpler than you might think. If you have the option to login or collect user information on your website, which will be the case in most of the cases. You can then use the same information to identify users and know if the same user has logged in on your website from both mobile and desktop and solve the problem for cross-device mapping.
You can access the user ids given by you or GA by default by going to user explorer under Reporting Tab in GA.

User IDs In application
Let’s take the example of an e commerce firm “Zipkart”. Zipkart has a login and have a lot of user doing cross device tracking. Now whenever a user comes to the website, zipkart assigns a session and a unique user id to the user to identify the users Now this user visits some pages and logs in the website on desktop and thus the personal information is now assigned to the user id given in the first place. Now when the user visits the same website on his/her mobile a new unique user Id is assigned but the moment the user logs in again, we come to know that it’s the same user and we combine both the user ids to give a final user id to the user and collate the interactions of the user across devices.
Please note that you can’t have personally identifiable information passed in the User id.
You can now pass the user id in the event label to get the interactions that happened from a user id.
To add user id to the tracking code, the following code is required
ga(‘create’, ‘UA-XXXX-Y’, ‘auto’);
ga(‘set’, ‘&uid’, {{ USER_ID }});
ga(‘send’, ‘pageview’);

Adding the User-ID to the Android SDK

t.set(“&uid”, {{ USER_ID }});
See the developer docs for more Android information.
Adding the User-ID to the iOS SDK

[tracker set:@”&uid” value:{{ USER_ID }}];

Adding the User-ID to a measurement protocol hit is actually really easy. All you need to do is add the uid parameter in each hit. So a hit might look something like this:

Adding the User-ID via Google Tag Manager
A quick note that you can also set the User-ID with Google Tag Manager. You’ll find the setting in the ‘More Settings > Fields to set’. You’ll also need to create a macro to pull the actual User-ID value from a cookie or the data layer.
3. Create a User ID View
As mentioned above, a User-ID view is a filtered view of your data only includiing hits in which the user id is passed in the data sent to analytics. It only includes hits in which you have set the User-ID value. This view also contains reports that show cross device usage and other user-centric metrics.
Please note, this view is in ADDITION to the other views that you have for a property. This means that you will need to configure things like goals, filters custom reports, dashboards, etc. on this new view.
A User ID view is a special reporting view that doesn’t include all of your data. These views only include data from sessions in which a User ID (and related data) is sent to Analytics. To analyze all of your data – including data from sessions in which an ID is not sent to Analytics – use a different view.
Users are calculated differently in User ID views
Each ID sent to Analytics is counted as a unique user. This means that all engagement activity associated with the same ID is attributed to one user, even if these activities occur over several sessions and devices over an extended period of time.
Although this more accurately reflects the real way users engage with online content, the total number of users reported in a User ID view are likely to be different than the total number of users you see reported in a non-User ID view, or in another analytics solution.
The date range is limited to 90 days in the Cross Device reports
In all of the Cross Device reports, the date picker is limited to 90 days. If you know you need to analyze data older than 90 days, export your reports on a regular basis and save them to compare to future data.
Cross Device reports are only available within a User ID view
There are three Cross Device reports: Device Overlap, Device Paths, and Acquisition Device. These reports display data collected during sessions in which a User ID is sent to Analytics. These reports are only available in a User ID view.
Tn case differnet browsers are being used on the same device, then different cookies are set for each browser respectively as cookies are browser specific which could spike the data for unique visitors landing on our website.
Thus, user id might look to be a daunting concept to understand but is really a simple simulation of actual consumers visiting an offline store. While the concept of User id is not perfect is under continual improvement in terms of accurately defining the users. With google becoming better in terms of recognising cross device behaviour, we can expect a lot in coming few years.