This API helps you to get the Google Core Web Vitals Metrics.

Getting Web Vitals Metrics

To get web vitals metrics for all pages, send the following request:

GET /v2/projects/:projectId/webvitals

Sample

copy
icon/buttons/copy
curl -H "X-API-KEY: <YOUR_API_KEY>" \
     "https://api.atatus.com/v2/projects/<projectId>/webvitals?timeDur=7d"
copy
icon/buttons/copy
curl -H "X-API-KEY: 79769089efbb4767a542e0696448e34c" \
     "https://api.atatus.com/v2/projects/5c7cb42cdbe639200c330e52/webvitals?timeDur=7d"

Parameters

Name Description
apiKey (Required) API Key to read data. See here to generate new API Key.
projectId (Required) A unique identifier of the project. See here to locate the Project ID
timeDur (Required) The time duration. Example: 30m, 60m, 6h, 12h, 1d, 2d, 3d, 7d, 14d, 1M
timeStart & timeEnd Instead of timeDur, you can give custom timeStart and timeEnd. Format: YYYY-MM-DD+HH:mm Eg: timeStart=2020-03-01+00:00&timeEnd=2020-03-06+00:00

Response

{
  "data": [
    {
      "name": "fcp",
      "metrics": [
        {
          "name": "Good",
          "count": 12,
          "percentage": 100
        },
        {
          "name": "Needs Improvement",
          "count": 0,
          "percentage": 0
        },
        {
          "name": "Poor",
          "count": 0,
          "percentage": 0
        }
      ],
      "avg": 230.6679,
      "affectedUser": 0
    },
    {
      "name": "lcp",
      "metrics": [
        {
          "name": "Good",
          "count": 5,
          "percentage": 41.66
        },
        {
          "name": "Needs Improvement",
          "count": 5,
          "percentage": 41.67
        },
        {
          "name": "Poor",
          "count": 2,
          "percentage": 16.67
        }
      ],
      "avg": 2891.8383,
      "affectedUser": 1
    },
    {
      "name": "fid",
      "metrics": [
        {
          "name": "Good",
          "count": 8,
          "percentage": 100
        },
        {
          "name": "Needs Improvement",
          "count": 0,
          "percentage": 0
        },
        {
          "name": "Poor",
          "count": 0,
          "percentage": 0
        }
      ],
      "avg": 3.5963,
      "affectedUser": 0
    },
    {
      "name": "cls",
      "metrics": [
        {
          "name": "Good",
          "count": 6,
          "percentage": 50
        },
        {
          "name": "Needs Improvement",
          "count": 3,
          "percentage": 25
        },
        {
          "name": "Poor",
          "count": 3,
          "percentage": 25
        }
      ],
      "avg": 0.1888,
      "affectedUser": 1
    },
    {
      "name": "ttfb",
      "metrics": [
        {
          "name": "Good",
          "count": 13,
          "percentage": 100
        },
        {
          "name": "Needs Improvement",
          "count": 0,
          "percentage": 0
        },
        {
          "name": "Poor",
          "count": 0,
          "percentage": 0
        }
      ],
      "avg": 31.3077,
      "affectedUser": 0
    }
  ]
}

Getting Web Vitals Metrics for a specific path

You can get web vitals for a specific page with search query parameter.

GET /v2/projects/:projectId/webvitals?search=keyword

Sample

copy
icon/buttons/copy
curl -H "X-API-KEY: <YOUR_API_KEY>" \
     "https://api.atatus.com/v2/projects/<projectId>/webvitals?timeDur=7d"
copy
icon/buttons/copy
curl -H "X-API-KEY: 79769089efbb4767a542e0696448e34c" \
     "https://api.atatus.com/v2/projects/5c7cb42cdbe639200c330e52/webvitals?search=dashboard&timeDur=7d"

Parameters

Name Description
apiKey (Required) API Key to read data. See here to generate new API Key.
projectId (Required) A unique identifier of the project. See here to locate the Project ID
search Keyword for search pages
timeDur (Required) The time duration. Example: 30m, 60m, 6h, 12h, 1d, 2d, 3d, 7d, 14d, 1M
timeStart & timeEnd Instead of timeDur, you can give custom timeStart and timeEnd. Format: YYYY-MM-DD+HH:mm Eg: timeStart=2020-03-01+00:00&timeEnd=2020-03-06+00:00

Response

{
  "data": [
    {
      "name": "fcp",
      "metrics": [
        {
          "name": "Good",
          "count": 2,
          "percentage": 100
        },
        {
          "name": "Needs Improvement",
          "count": 0,
          "percentage": 0
        },
        {
          "name": "Poor",
          "count": 0,
          "percentage": 0
        }
      ],
      "avg": 879.6,
      "affectedUser": 0
    },
    {
      "name": "lcp",
      "metrics": [
        {
          "name": "Good",
          "count": 2,
          "percentage": 100
        },
        {
          "name": "Needs Improvement",
          "count": 0,
          "percentage": 0
        },
        {
          "name": "Poor",
          "count": 0,
          "percentage": 0
        }
      ],
      "avg": 1640.6,
      "affectedUser": 0
    },
    {
      "name": "fid",
      "metrics": [
        {
          "name": "Good",
          "count": 2,
          "percentage": 100
        },
        {
          "name": "Needs Improvement",
          "count": 0,
          "percentage": 0
        },
        {
          "name": "Poor",
          "count": 0,
          "percentage": 0
        }
      ],
      "avg": 2.2,
      "affectedUser": 0
    },
    {
      "name": "cls",
      "metrics": [
        {
          "name": "Good",
          "count": 0,
          "percentage": 0
        },
        {
          "name": "Needs Improvement",
          "count": 0,
          "percentage": 0
        },
        {
          "name": "Poor",
          "count": 2,
          "percentage": 100
        }
      ],
      "avg": 0.614,
      "affectedUser": 1
    },
    {
      "name": "ttfb",
      "metrics": [
        {
          "name": "Good",
          "count": 2,
          "percentage": 66.67
        },
        {
          "name": "Needs Improvement",
          "count": 1,
          "percentage": 33.33
        },
        {
          "name": "Poor",
          "count": 0,
          "percentage": 0
        }
      ],
      "avg": 100.3333,
      "affectedUser": 0
    }
  ]
}