Emiliano
Emiliano

Reputation: 728

Google Analytics Data API (ga4) obtain email or username current user who call

in universal analytics you can obtain easily the username, you receive the username in a basic call, I use that username so while I migrate to GA4 I wonder where is that data, I can consume severals endpoints but the most close was Account.UserLinks but that retrieve all user linked with an account but not say which user am I. I try add different scopes but nothing, any ideas?

scopes used

https://www.googleapis.com/auth/analytics
https://www.googleapis.com/auth/analytics.manage.users.readonly
https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/userinfo.profile

Also Accounts don't provide that data

{
  "name": "accounts/6666",
  "createTime": "2018-11-16T18:27:26Z",
  "updateTime": "2019-08-13T21:17:12.851Z",
  "displayName": "Dummy",
  "regionCode": "PR"
}

I already know how obtain from universal but I only want use GA4 new api thanks in advance

Upvotes: 1

Views: 956

Answers (1)

Ilya Kuleshov
Ilya Kuleshov

Reputation: 584

You can get the signed in user's profile information using the Google Sign-In JavaScript library or the new Google Identity Services.

Upvotes: 1

Related Questions