Google PageSpeed API Key

he Google PageSpeed API lets SpeedTest Pro analyze your pages without hitting rate limits. Good news: it’s completely free for most users.

Why You Need This

Without an API key, Google limits how many tests you can run. You might see an error like “Your website has been restricted by Google” after a few tests.

With an API key, you get:

  • More tests per day
  • Faster results
  • No random restrictions

Think of it like a VIP pass for your website performance tests.

Before You Start

You’ll need:

  • A Google account (Gmail works fine)
  • About 5-10 minutes
  • Access to your SpeedTest Pro settings

Getting Your API Key

Step 1: Go to Google Cloud Console

  1. Open the Google Cloud Console. Head to console.cloud.google.com.
  2. Sign in with your Google account. Use any Gmail or Google Workspace account.
  3. Accept the terms of service. First-time users will see this popup.

Step 2: Create a Project

Google organizes everything into projects. You need one for your API key.

  1. Click the project dropdown. It’s at the top of the page, usually says “Select a project.”
  2. Click New Project. It’s in the top right of the popup.
  3. Name your project. Something like “My Website Speed Tests” works fine.
  4. Click Create. Wait a few seconds for it to finish.
  5. Select your new project. Click the project dropdown again and choose the one you just created.

Step 3: Enable the PageSpeed Insights API

Now you need to turn on the specific API.

  1. Open the Navigation Menu. Click the three horizontal lines in the top left.
  2. Go to APIs & Services > Library. This shows all available APIs.
  3. Search for PageSpeed Insights. Type it in the search box.
  4. Click on PageSpeed Insights API. It should be the first result.
  5. Click Enable. Blue button at the top of the page.

This might take a few seconds. You’ll see a confirmation when it’s done.

Step 4: Create Your API Key

Almost there. Time to generate the actual key.

  1. Go to APIs & Services > Credentials. Use the navigation menu or click the link in the API dashboard.
  2. Click Create Credentials. Blue button at the top.
  3. Select API Key. It’s the first option in the dropdown.
  4. Copy your API key. A popup shows your new key. Copy it now.

Important: Keep this key private. Anyone with it can use your quota.

Step 5: Add the Key to SpeedTest Pro

Final step. Let’s connect everything.

  1. Open your WordPress admin panel.
  2. Go to Speedtest Pro > Settings.
  3. Find the PageSpeed Insights API Key field.
  4. Paste your API key.
  5. Click Save Changes.

That’s it. Your page speed tests now use your personal API quota.

Testing Your Setup

Want to make sure it works?

  1. Go to Speedtest Pro > Page Speed Testing.
  2. Enter your homepage URL.
  3. Click Run Test.

If the test runs without errors, you’re all set.

API Key Best Practices

Keep It Secure

  • Never share your API key publicly
  • Don’t commit it to public code repositories
  • Regenerate it if you think it’s been exposed

Monitor Your Usage

The free tier gives you plenty of tests for normal use. But if you’re testing hundreds of pages daily, you might want to check your usage:

  1. Go to the Google Cloud Console
  2. Navigate to APIs & Services > PageSpeed Insights API
  3. Check the quotas and usage graphs

What If You Hit Limits?

The free tier is generous, but here’s what happens if you max out:

  • Tests will fail with a quota error
  • Wait 24 hours for the quota to reset
  • Or upgrade to a paid tier (rarely needed)

For most websites running a few tests per day, you’ll never hit these limits.

Troubleshooting

Invalid API Key Error

Double-check you:

  • Copied the entire key (they’re long)
  • Enabled the PageSpeed Insights API
  • Selected the correct project

Try regenerating the key if none of that helps.

API Not Enabled Error

Go back to the Google Cloud Console:

  1. Open APIs & Services > Library
  2. Search for PageSpeed Insights
  3. Make sure it says “Enabled” (not a blue Enable button)

Still Getting Rate Limited

Your key might not be configured correctly. Try:

  1. Delete the key from SpeedTest Pro settings
  2. Run a test (should fail)
  3. Add the key back
  4. Try again