Kenny Tai Huynh
Kenny Tai Huynh

Reputation: 1599

Query Google Analytics by User ID in custom dimension

Google Analytics v4 supports to query the reports like "User Explorer". I can query the list of userid in custom dimension. My request is:

{"reportRequests": [
          {
            "viewId": "xxxx",
            "includeEmptyRows": true,
            "dateRanges": [
              {
                "startDate": "2daysAgo",
                "endDate": "today"
              }
            ],
            "metrics": [
              {
                "expression": "ga:sessions"
              },
              {
                "expression": "ga:avgSessionDuration"
              }
            ],
              "dimensions": [
                {
                  "name": "ga:dimension1"
                }
              ]

          }
        ]
}

I got the successful result. But I would like to query the detail of each userId. Something likes one individual Userid in a custom dimension same as "User Report" in Google Analytics. I googled around but did not have any luck. For example in here:

Query Google Analytics by User ID

https://ga-dev-tools.appspot.com/

I'm not sure that is there any support for the query individual userId like: "filtersExpression": "ga:userId==abc"

Any recommendation is really appreciated.

Thanks

Upvotes: 0

Views: 1655

Answers (3)

Himanshu Veishnaw
Himanshu Veishnaw

Reputation: 21

try to pass custom dimension like
"dimensions": [{ "name": "customUser:user_id_dimensions" }

here user_id_dimensions is custom dimension name.

Upvotes: 0

zenab salim
zenab salim

Reputation: 48

You need to filter out from the custom dimension. try this ga:dimension1==abc

Upvotes: 0

Tony Simonovsky
Tony Simonovsky

Reputation: 199

If you are using free version of GA querying by user id won't be possible unless you use custom dimension to store user id yourself.

Upvotes: 0

Related Questions