Query Google Analytics by User ID

北慕城南 提交于 2019-12-02 20:33:27

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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!