Getting a Google PageSpeed API key is free and can be obtained via Google.
You do need a Google/Gmail account before you get started.
So please create one first if you haven’t already (https://accounts.google.com/SignUp).
- Go to https://code.google.com/apis/console
- Login with your account if you haven’t already done so.
- Select a project in the top left corner (select from dropdown) if you already have a open project in there you want to use, otherwise create a new one.
- Click on the “Google APIs” logo in the top left.
- You will see a “Enable API” button right next to the text “Dashboard”, click that button.
- Within the search box, search for “Pagespeed”. It will autocomplete and give you 1 result. Click that result (PageSpeed Insights).
- Now you will be within the “PageSpeed Insights API” page. There should be an “Enable” button right next to that title. Click it.
- Now click the “Credentials” button in the menu on the left.
- Click “Create credentials” within this page and click “API key (if there are already API keys available in the list of this page, use one key available there).
- A pop-up will be displayed, showing the API key. Copy that key.
- Optionally, you can restrict the API key, It is a good idea you can limit use to certain HTTP referrers (websites) and specific IP addresses. You can Google more about how to use that and when to use that, but for this scenario you only need the API key!
- Login to any dashboard that needs a PageSpeed API key and you can paste the key you just copied from the google API console.