Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query Google Analytics by User ID

Tags:

Is there a way to query results using the Core Reporting API (v3) and filtering those results by the User ID assuming that it is being sent to Google Analytics properly?

I've googled this question a lot and read a whole bunch of articles but I did not find one place that does that. Moreover, the fact that I cannot see the User ID anywhere in the reporting interface makes me doubt that this is even possible. I'm guessing I will have to dome something similar to what is recommended here in order to do it?

UPDATE

Apparently, the purpose of my question is not very clear as highlighted by Eike's comment below. What I want to do is generate a report for a specific user with a specific Id using the client API and then combine those results with information I have about this user in my system's database to do something as per my business requirements.

like image 984
Kassem Avatar asked Jun 24 '14 13:06

Kassem


People also ask

Can we track User-ID in Google Analytics?

While many marketers believe it's out of the question to track individual users in Google Analytics, it's not impossible. If your application or website has a login authentication system, then it is possible to track users in Google Analytics with it's User ID tracking feature.

Where can I find Google Analytics customer ID?

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.


2 Answers

The best place to turn to for such questions is the Dimensions and Metrics Reference. If the dimension you're looking for is not there then you cannot query it or use it in a filter.

The list is really well maintained, so it's not very likely there are as-of-yet undocumented dimensions you could use.

User id is not there.

like image 198
Eike Pierstorff Avatar answered Feb 24 '23 02:02

Eike Pierstorff


Well there is a way now.

The docs says the following steps

  1. Set up User-ID in your account
    1. Agree to the User-ID Policy
    2. Read the User-ID Policy. Under I agree to the User-ID Policy, set the switch to ON. Agreeing to the policy enables the feature in your account.
    3. Click Next Step.

2. Set up User-ID in your tracking code

After you enable User-ID by agreeing to the policy, you must implement User-ID in your tracking code.

To employ User-ID, you must be able to generate your own unique IDs, assign IDs to new users and consistently reassign the same IDs to returning users, and include these IDs in the data you send to Analytics.

In this step, you can see the line of code that you have to add to your Analytics tracking code:

ga('set', 'userId', {{USER_ID}}); // Set the user ID using signed-in user_id.

3. Create a User-ID reporting view

User-ID data can appear only in a dedicated User-ID view.

  1. Click Create.
  2. Enter a Reporting View Name. You might want to include the term "User ID" in the name to help you remember that this is a special User-ID view.
  3. Select a Reporting Time Zone.
  4. Under Show User-ID Reports, set the switch to ON.
  5. Click Create.

Related resources https://support.google.com/analytics/answer/3123666?hl=en

like image 21
Mohd. Umar Avatar answered Feb 24 '23 03:02

Mohd. Umar