0

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

Community
  • 1
  • 1
Kenny Tai Huynh
  • 1,464
  • 2
  • 11
  • 23

3 Answers3

0

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.

Tony Simonovsky
  • 169
  • 1
  • 9
  • Hi. I'm using custom dimension already. As you can see in my question, I can query a list of UserIds in custom dimension. The issue is, I'd like to query for one userId to get the whole detail of it. Any suggestion for that?! – Kenny Tai Huynh Mar 10 '17 at 22:03
0

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

  • Have you tried to call this in GA request?! do you mean you can do sth like this in your request?! "dimensions": [ { "name":"ga:dimension1==abc" } – Kenny Tai Huynh May 18 '17 at 17:25
  • @KennyTaiHuynh late reply but as zenab suggested you can supply a (custom) dimension value as filter, see https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters Not sure why his answer was downvoted; should work. – Arthur Mar 13 '19 at 12:27
0

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

here user_id_dimensions is custom dimension name.