Chapter 6. Getting a PageSpeed Insights API Key Pro

Abstract

Give your optimization runs a PageSpeed Insights API key of your own: why it's worth it, how to create one in Google Cloud, how to add it to JCH Optimize, and how it is used.

An AI-assisted optimization run measures your page with Google's PageSpeed Insights many times: before and after each change, on mobile and on desktop. The What to expect box in the run window shows how many requests a run typically makes.

Without a key of your own, runs use JCH Optimize's shared key. Its daily limit is shared by every site that uses it, so on a busy day a run can pause because the limit has run out. A key of your own is free, and its limit is yours alone. We recommend adding one before your first run.

Creating the Key

You need a Google account. Google doesn't charge for the PageSpeed Insights API.

Procedure 6.1. Create a PageSpeed Insights API key
  1. Open the Google Cloud console at https://console.cloud.google.com/ and sign in with your Google account.

  2. Choose a project, or create one: open the project list at the top of the page, click New project, give it a name such as PageSpeed for example.com, and click Create. Make sure the project is selected at the top of the page.

  3. Turn on the API: go to APIs & Services > Library, search for PageSpeed Insights API, open it, and click Enable.

  4. Create the key: go to APIs & Services > Credentials, click Create credentials and choose API key. Google shows the new key, a long code starting with AIza. Copy it.

  5. Restrict the key to PageSpeed Insights: on the Credentials page, click the key's name. Under API restrictions, choose Restrict key and select only PageSpeed Insights API. Click Save.

    Important

    Leave Application restrictions set to None. The requests are made by JCH Optimize's analysis service, not by your site or your browser, so a restriction to your website or your server's IP address would block every one of them. Restricting the key to the PageSpeed Insights API is what keeps it from being used for anything else.

On This Page