First, to set up the Google Indexing API, go to website developer and create a Service account. Specify the role as "Owner".
Go to the project and create an access key. Click "Add Key", select "JSON" and upload the script.
Go to the project details and copy the Email. We need to extend access to this address in the Google search console.
Please note that access must be with the "Owner" rights.
Downloading github files
Go to github and download the files at hereby link. Transfer the files to the desired folder at once.
Paste the downloaded project script into the "service_account.json" file. Copy the selected urls to be indexed into the "urls" file.
Go to Windows Powershell
Download and install Windows Powershell on official website.
Commands to load libraries into a script folder in PowerShell. Write them in the following order:
npm install requests
npm audit fix
npm audit fix -force
Next, we write the paths for indexing:
cd E:\index\project folder
node index.js (run the script)
Possible problems
- If you get an error, upload the library to the project folder via Powershell:
npm install requests
npm audit fix
npm audit fix -force - Check if the API is open by link.
- Do not forget about the limits of the Google Indexing API.
- The Google Indexing API account must have full "Owner" access to the Google search console.
Setting up a plugin on WordPress
Go to WordPress and install the plugin instant indexing for Google. Activate the plugin and go to the settings.
Add the file "service_account.json" and select the pages to be automatically indexed - save the changes.