Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
406 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 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...