Skip to content
Documentation
Plugin page
Getting Started

Get a Google API key

  • Updated
  • Insights v5.0.0
  • 1 min read
On this page

The plugin talks to Google through the PageSpeed Insights API, and Google asks for an API key for that. The key is free. All you need is a Google account, like a Gmail address.

Google changes the look of its Cloud Console from time to time, so your screens may not match ours exactly. The steps stay the same: create a project, turn on the PageSpeed Insights API, create a key and paste it into the plugin.

1. Create a project

  1. Go to console.cloud.google.com and sign in.

  2. Click the project picker at the top of the page, then New project.

  3. Give it any name, for example PageSpeed, leave the location as it is and click Create. It takes a few seconds.

  4. Make sure the new project is selected in the project picker before you go on.

New Project form in Google Cloud with the project name PageSpeed
InfoAlready have a Google Cloud project you want to use? Select it and skip to the next step.

2. Turn on the PageSpeed Insights API

  1. Open the menu and go to APIs & Services, then click Enable APIs and services at the top.

  2. Search for PageSpeed Insights API and open it.

  3. Click Enable.

APIs and Services dashboard with the Enable APIs and services button
API Library search showing PageSpeed Insights API
PageSpeed Insights API page with the Enable button
InfoShortcut: the Get an API key link in the plugin settings opens this page directly. Pick your project and click Enable.

3. Create the API key

  1. Go to APIs & Services → Credentials.

  2. Click Create credentials → API key.

Create credentials menu with API key highlighted

A window opens where you set up the key before Google creates it:

  1. Give the key a name you will recognise later, for example PageSpeed for my site.

  2. Under Select API restrictions, tick PageSpeed Insights API and click OK. This way the key can only be used for PageSpeed checks, which is safer if it ever leaks.

  3. Under Application restrictions, keep None. If you know your server’s IP address, you can choose IP addresses and enter it instead.

  4. Click Create, then copy the key Google shows you. You can always come back to the Credentials page to copy it again.

Create API key window with the PageSpeed Insights API restriction and application restrictions set to None
WarningDo not choose Websites under application restrictions. The plugin calls Google from your server, not from a browser, so a website restriction blocks every scan. This is the most common reason a key does not work.

4. Add the key to the plugin

  1. In WordPress go to Tools → Pagespeed Insights → Settings.

  2. Paste the key into API key and click Check key.

  3. When you see The API key works, click Save settings.

API key field with the Check key button in the plugin settings
Check key tests the key with Google before you save it.

If the check fails, the message tells you why: the key is wrong, the API is not turned on yet, or a restriction blocks your server. After enabling the API, give Google a minute before you check again.

How many checks can I run?

Google gives each project 25,000 requests per day for free. One page is one request, or two if you check both desktop and mobile. That is enough for about 12,000 pages a day, far more than most sites need. If you ever hit the limit, the plugin stops the scan and tells you. The quota resets at midnight Pacific Time.

Was this page helpful?

Insights from Google PageSpeed
Explore plugins