I've got a website that needs user logged in before they can use, I want to track the behavior of each single user. Is it possible to do this? Any advice? Thanks very much!
4 Answers
Yes this is possible.
The simplest way might be to define a Custom Variable scoped to the visitor, and bind it to the value equal to the (obfuscated) user's ID (the one you assigned them when they registered):
pageTracker._setCustomVar(1, "Registered TempID", "345X34RT", 1)
The four arguments that you pass into a Custom Variable are: slot number (any integer 1 through 5, which won't change in this case; 'TempID' which is a variable name i chose for this variable; 'TempID', the value for that variable that maps to (but must not not personally identify or it will violate Google's Privacy Policy) a registered user; the final argument '1' is the scope, which i is '1' in this case because this variable is scoped to the visitor).
This new variable is sent to the GA server via a call to _trackPageview() so make sure you the custom variable is set before trackPageview() is called.
There are a several excellent resources, including step-by-step tutorials on GA Custom Variables, including a blog post by ROI Analytics, which is think is one of the best.
Once you've done to view this Custom Variable in the Google Analytics Web Client, go to the left-hand panel and click on the Visitor heading; the last item under this heading (and just before the next major heading which is Traffic Sources) you will see the Custom Variables subheading.
This is where you can view the data for the custom variables you set. For instance, the panel will look something like this:
-
The quotes in your code sample seem wrong? Interesting answer tho, will try it sometime. – James Oct 27 '10 at 10:02
-
the second argument had an unpaired quote, fixed now. – doug Oct 27 '10 at 11:54
-
HI, thanks very much. Buts my website has some sort of special condition. I want to track each single user's usages: Do they like or not like this website, how often do they use, and the important thing is get the tracking data from each single user, does this violate Google's rules? All the users are my clients anyway. – user483144 Oct 27 '10 at 22:58
-
@james I believe the quotes were still wrong / misleading. Fixed now. – philfreo Oct 01 '13 at 15:48
It is technically possible, but prohibited by the terms of service that you agreed to when you installed Google Analytics (you read, them, right?).
From: http://www.google.com/analytics/tos.html
7. PRIVACY . You will not (and will not allow any third party to) use the Service to track or collect personally identifiable information of Internet users, nor will You (or will You allow any third party to) associate any data gathered from Your website(s) (or such third parties' website(s)) with any personally identifying information from any source as part of Your use (or such third parties' use) of the Service. You will have and abide by an appropriate privacy policy and will comply with all applicable laws relating to the collection of information from visitors to Your websites. You must post a privacy policy and that policy must provide notice of your use of a cookie that collects anonymous traffic data.
Seems pretty clear.

- 4,932
- 2
- 32
- 40
-
5Personally Identifiable information is different from tracking their usage habits. Google prohibits you from gathering John Doe's personal information such as his address, phone number, etc etc so as to pair his analytics to HIM. He can track what the user clicks and such as long as it's for User 3904523465908 and not John Doe – Nathaniel Schweinberg Nov 28 '12 at 22:39
-
Hi Nathanial. Good point, if you wanted to, you could see the actions of each individual user, as long as you don't tie the actions to a real account. I just assumed that since the asker of the question has a site that requires users to login, that site would have PII about the user. Bad assumption. So, anyone reading this, feel free to assign a unique userid and track that through GA, as long as you never tie that userid to any information that could be used to identify the person. – mooreds Dec 04 '12 at 00:14
-
1Petr, from wikipedia (http://en.wikipedia.org/wiki/Personally_identifiable_information): PII "is information that can be used to uniquely identify, contact, or locate a single person or can be used with other sources to uniquely identify a single individual." – mooreds Dec 04 '12 at 00:15
-
1
-
This link explains it in further detail along with a workaround https://davidsimpson.me/2013/10/17/identifying-your-users-in-google-analytics-while-complying-with-section-7-of-the-terms-of-service/ – Vikram Jul 26 '16 at 12:14
-
1Reading this post from the future I realize how much Google's TOS has changed since then. Makes you think, right? – sr9yar May 21 '20 at 13:38
It's possible via User-ID javascript : User-ID j enables the analysis of groups of sessions, across devices, using a unique and persistent ID
ga('create', 'UA-XXXX-Y', 'auto');
ga('set', '&uid', {{ USER_ID }});
ga('send', 'pageview');
{{ USER_ID }} is a unique, persistent, and non-personally identifiable string ID that represents a user or signed-in account across devices.
https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id

- 121
- 1
- 3
-
this feature is in closed beta, do you know if it's available somehow? – Himmators Jan 28 '14 at 13:57
-
Still this feature is in beta, I think it is a most up-to-date solution. – baxang Feb 18 '14 at 08:31
-
is it possibile to see the user id value in the google analytics frontend? – patrick Oct 06 '15 at 16:29
The cookies that google analytics use, will track the same user, so long as they use the same PC and dont clear their cookies. Thats how GA can tell if a customer is a new user or a returning user. However, it is limited for the reasons I gave above.

- 597
- 4
- 8