2024-01-24 12:13:56 +03:00
# Google Indexing Script
Use this script to get your entire site indexed on Google in less than 48 hours. No tricks, no hacks, just a simple script and a Google API.
2024-01-25 17:10:16 +03:00
You can read more about the motivation behind it and how it works in this blog post https://seogets.com/blog/google-indexing-script
2024-01-24 12:13:56 +03:00
> [!IMPORTANT]
2024-01-24 19:06:14 +03:00
> 1. Indexing != Ranking. This will not help your content/page rank on Google, it'll just let Google know about the existence of all your pages.
2024-01-24 19:05:30 +03:00
> 2. This script uses [Google Indexing API](https://developers.google.com/search/apis/indexing-api/v3/quickstart). While there is no absolute guarantee that every page will be indexed, recent tests conducted in December 2023 have shown a notably high success rate.
2024-01-24 12:13:56 +03:00
## Requirements
- Install [Node.js ](https://nodejs.org/en/download )
- An account on [Google Search Console ](https://search.google.com/search-console/about ) with the verified sites you want to index
- An account on [Google Cloud ](https://console.cloud.google.com/ )
## Preparation
2024-03-02 19:35:14 +03:00
1. Follow this [guide ](https://developers.google.com/search/apis/indexing-api/v3/prereqs ) from Google. By the end of it, you should have a project on Google Cloud with the Indexing API enabled, a service account with the `Owner` permission on your sites.
2. Make sure you enable both `Google Search Console API` and `Web Search Indexing API` on your [Google Project ➤ API Services ➤ Enabled API & Services ](https://console.cloud.google.com/apis/dashboard ).
3. [Download the JSON ](https://github.com/goenning/google-indexing-script/issues/2 ) file with the credentials of your service account and save it in the same folder as the script. The file should be named `service_account.json`
## Installation
### Using CLI
Install the cli globally on your machine.
```bash
npm i -g google-indexing-script
```
2024-03-04 18:07:36 +03:00
### Using the repository
2024-03-02 19:35:14 +03:00
2024-03-04 18:07:36 +03:00
Clone the repository to your machine.
2024-03-02 19:35:14 +03:00
```bash
2024-03-04 18:07:36 +03:00
git clone https://github.com/goenning/google-indexing-script.git
cd google-indexing-script
2024-03-02 19:35:14 +03:00
```
2024-03-04 18:07:36 +03:00
Install and build the project.
2024-03-02 19:35:14 +03:00
```bash
2024-03-04 18:07:36 +03:00
npm install
npm run build
npm i -g .
2024-03-02 19:35:14 +03:00
```
2024-03-04 18:07:36 +03:00
> [!NOTE]
> Ensure you are using an up-to-date Node.js version, with a preference for v20 or later. Check your current version with `node -v`.
2024-03-04 18:11:32 +03:00
## Usage
2024-03-04 18:07:36 +03:00
< details open >
< summary > With < code > service_account.json< / code > < i > (recommended)< / i > < / summary >
2024-03-02 19:35:14 +03:00
2024-03-04 18:07:36 +03:00
Create a `.gis` directory in your home folder and move the `service_account.json` file there.
2024-03-02 19:35:14 +03:00
```bash
2024-03-04 18:07:36 +03:00
mkdir ~/.gis
mv service_account.json ~/.gis
2024-03-02 19:35:14 +03:00
```
Run the script with the domain or url you want to index.
```bash
2024-03-04 18:07:36 +03:00
gis < domain or url >
# `domain` property on gsc
2024-03-02 19:35:14 +03:00
gis seogets.com
2024-03-04 18:07:36 +03:00
# `url prefix` property on gsc
gis https://seogets.com
2024-03-02 19:35:14 +03:00
```
2024-03-04 18:11:32 +03:00
2024-03-04 18:14:32 +03:00
When in doubt try both 😀
2024-03-02 19:35:14 +03:00
2024-03-04 18:07:36 +03:00
Here are some other ways to run the script:
2024-03-02 19:35:14 +03:00
2024-03-05 02:29:36 +03:00
```bash
2024-03-04 18:07:36 +03:00
# custom path to service_account.json
gis seogets.com --path /path/to/service_account.json
# long version command
google-indexing-script seogets.com
# cloned repository
npm run index seogets.com
```
< / details >
2024-03-02 19:35:14 +03:00
2024-03-04 18:07:36 +03:00
< details >
< summary > With environment variables< / summary >
2024-03-02 19:35:14 +03:00
2024-03-04 18:07:36 +03:00
Open `service_account.json` and copy the `client_email` and `private_key` values.
2024-03-02 19:35:14 +03:00
2024-03-04 18:07:36 +03:00
Run the script with the domain or url you want to index.
2024-03-02 19:35:14 +03:00
```bash
2024-03-04 18:07:36 +03:00
GIS_CLIENT_EMAIL=your-client-email GIS_PRIVATE_KEY=your-private-key gis seogets.com
2024-03-02 19:35:14 +03:00
```
2024-03-04 18:07:36 +03:00
< / details >
2024-03-02 19:35:14 +03:00
2024-03-04 18:07:36 +03:00
< details >
< summary > With arguments < i > (not recommended)< / i > < / summary >
2024-03-02 19:35:14 +03:00
2024-03-04 18:07:36 +03:00
Open `service_account.json` and copy the `client_email` and `private_key` values.
2024-03-02 19:35:14 +03:00
2024-03-04 18:07:36 +03:00
Once you have the values, run the script with the domain or url you want to index, the client email and the private key.
2024-03-02 19:35:14 +03:00
```bash
2024-03-05 02:32:07 +03:00
gis seogets.com --client-email your-client-email --private-key your-private-key
2024-03-02 19:35:14 +03:00
```
2024-03-04 18:07:36 +03:00
< / details >
2024-01-24 12:13:56 +03:00
Here's an example of what you should expect:
![](./output.png)
2024-03-04 18:14:32 +03:00
> [!IMPORTANT]
> - Your site must have 1 or more sitemaps submitted to Google Search Console. Otherwise, the script will not be able to find the pages to index.
> - You can run the script as many times as you want. It will only index the pages that are not already indexed.
> - Sites with a large number of pages might take a while to index, be patient.
2024-01-24 12:13:56 +03:00
## 📄 License
MIT License
2024-01-24 17:12:43 +03:00
## 💖 Sponsor
This project is sponsored by [SEO Gets ](https://seogets.com )
![](https://seogets.com/og.png)