0

I'm trying to get all profiles using ~all option with this endpoint

https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles

It doesn't return all profiles due to ~all for accounts. If I include account ID instead of ~all, then it returns profiles based on that account id - which are missing when used with ~all option.

https://www.googleapis.com/analytics/v3/management/accounts/89478503/webproperties/~all/profiles

Am I doing something wrong or is this GA API bug?

Ardent Coder
  • 3,777
  • 9
  • 27
  • 53
  • Why not use [account summaries list](https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/accountSummaries/list) – Linda Lawton - DaImTo May 22 '20 at 09:28
  • Yes, but I need all profile ids, not account ids - sorry if I wasn't clear. – David Pivoňka May 22 '20 at 10:58
  • Account summaries list returns all the accounts as a list with their web properties as a list with their profiles as a list in one call. All the profile ids are there you just have to loop though to find them. The only other way to do is its to loop though the account and web properties calls. – Linda Lawton - DaImTo May 22 '20 at 11:31

1 Answers1

0

I sugst you look into using account summaries list

GET https://www.googleapis.com/analytics/v3/management/accountSummaries

This will return all the account information for a user.

{
  "kind": "analytics#accountSummaries",
  "username": "me@gmail.com",
  "totalResults": 15,
  "startIndex": 1,
  "itemsPerPage": 1000,
  "items": [
    {
      "id": "59183475",
      "kind": "analytics#accountSummary",
      "name": "Cube Analytics",
      "webProperties": [
        {
          "kind": "analytics#webPropertySummary",
          "id": "UA-59183475-1",
          "name": "Cube Analytics",
          "internalWebPropertyId": "93305066",
          "level": "STANDARD",
          "websiteUrl": "XXXXXXX",
          "profiles": [
            {
              "kind": "analytics#profileSummary",
              "id": "115455750",
              "name": "Alaternate",
              "type": "WEB"
            },
            {
              "kind": "analytics#profileSummary",
              "id": "97191919",
              "name": "All Web Site Data",
              "type": "WEB"
            },
            {
              "kind": "analytics#profileSummary",
              "id": "178538323",
              "name": "MobileView",
              "type": "APP"
            }
          ]
        },      ]
}

By using this call you should only need to make one call and get all of the information back.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449