Use this script to export all your SEO data from Google Search Console including URLs, queries, clicks, impressions and rankings.
The Google Search Console interface is limited to exports of 1000 rows, the sample Google Search Console API script is limited to 25,000 rows - this script exports ALL available data for the date range.
-
This script uses Node.js
-
You can only collect data from sites where you are a 'verified owner' see GSC permissions
-
Using Terminal or command line, navigate to the script folder and run 'npm install'
-
Create a project in Google's Developer Console
-
Ensure you have enabled the Google Search Console API for your project found in the API library
-
You will need OAuth credentials to access your GSC data
-
Head to Google's Developer Console clicking your project --> APIs & auth --> credentials
-
Navigate to the Cloud Console and Create a new OAuth2 Client Id
-
Select Web Application for the application type
-
Add an authorized redirect URI with the value http://localhost:3000/oauth2callback (or applicable value for your scenario)
-
Click the Download icon next to your newly created OAuth2 Client Id
-
Save the credentials file in the scripts folder as 'oauth2.keys.json'
-
-
Update the index.js file with your siteUrl, startDate, endDate variables (line 8-10)
-
To start the script, navigate to the script folder using Terminal or command line and run 'node index.js'
-
When running the script you will be directed to a Google login screen, access whichever account has the permissions to the GSC profile you want to collect data from
-
Once the script is complete a gsc-export.csv file will be created containing all of your data for the given date range