0
votes

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?

1
Yes, but I need all profile ids, not account ids - sorry if I wasn't clear. - David Pivoňka
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. - DaImTo

1 Answers

0
votes

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": "[email protected]",
  "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.