Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
403 views
in Technique[技术] by (71.8m points)

Google Analytics access via API but webProperties empty

I'm expecting issue on accessing my GA account via API. As you can see from the response the entity webProperties is empty also if I have all permission and scopes active .

{
  "kind": "analytics#accountSummaries",
  "username": "[email protected]",
  "totalResults": 1,
  "startIndex": 1,
  "itemsPerPage": 1000,
  "items": [
    {
      "id": "183028779",
      "kind": "analytics#accountSummary",
      "name": "Libra Factory B.V.",
      "webProperties": []
    }
  ]
}

Also using https://ga-dev-tools.appspot.com/account-explorer/ it only show account but no property. Being the account part of an Google Workplace organization, is there anything I need to enable in the organization panel to enable Google API ?

Thanks in advance for any help. Fabio

question from:https://stackoverflow.com/questions/65845202/google-analytics-access-via-api-but-webproperties-empty

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The web property is empty because your account is GA4 and not universal analytics. Ga4 accounts dont have web properties.

You are also using the account summaries call from the management api which is for use with universal analytics not GA4.

You should try using the admin api which is designed for use with Ga4 accounts.

GET https://analyticsadmin.googleapis.com/v1alpha/accountSummaries

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...