Google Indexing Script
The Google Indexing Script is a tool designed to assist webmasters in getting their entire site indexed by Google in under 48 hours without deploying any tricks or hacks. By leveraging the Google API, this script allows Google to acknowledge the existence of your web pages, although it does not guarantee improved ranking on search results.
Key Considerations
- Targeted Structured Data: The script is dependent on pages having either
JobPosting
orBroadcastEvent
structured data. - Indexing vs. Ranking: While the script helps in getting your site indexed, it does not influence the ranking of your pages in Google search results.
What You'll Need
To make use of this script, the following are necessary:
- Node.js: Install from the official Node.js website.
- Google Search Console Account: Ensure your sites are verified on Google Search Console.
- Google Cloud Account: Set up an account on Google Cloud.
Setting Up
- Set up a project on Google Cloud and enable the Indexing API by following Google's guide.
- Enable the required APIs:
- Download your service account's JSON credentials and name it
service_account.json
. Place it alongside the script.
Installation Options
CLI Method
You can install the CLI version globally on your machine using:
npm i -g google-indexing-script
Repository Method
Alternatively, clone the repository:
git clone https://github.com/goenning/google-indexing-script.git
cd google-indexing-script
npm install
npm run build
npm i -g .
Note: Use Node.js version 20 or later for optimal performance. Verify your version with
node -v
.
Running the Script
Recommended Usage
For the most straightforward usage, create a .gis
directory in your home folder and move the service_account.json
file there:
mkdir ~/.gis
mv service_account.json ~/.gis
Run the script with your target domain or URL:
gis <domain or url>
# example
gis seogets.com
Other Methods
-
Custom path to
service_account.json
:gis seogets.com --path /path/to/service_account.json
-
Using environment variables:
Open
service_account.json
and extractclient_email
andprivate_key
. Then run:GIS_CLIENT_EMAIL=your-client-email GIS_PRIVATE_KEY=your-private-key gis seogets.com
-
As a npm module:
Install the module:
npm i google-indexing-script
Then use it in your JavaScript project:
import { index } from "google-indexing-script"; import serviceAccount from "./service_account.json"; index("seogets.com", { client_email: serviceAccount.client_email, private_key: serviceAccount.private_key, }) .then(console.log) .catch(console.error);
Important Considerations
- Sitemaps: Ensure at least one sitemap is submitted to Google Search Console for site indexing.
- Re-run Capability: The script can be repeatedly run to index newly added pages.
- Time for Indexing: Large sites may require more time for complete indexing, so patience is advised.
Managing Quotas
API usage quotas may impact service. A retry mechanism for request exceedance per minute can be configured with:
export GIS_QUOTA_RPM_RETRY=true
Or within a JavaScript context:
import { index } from 'google-indexing-script';
import serviceAccount from './service_account.json';
index('seogets.com', {
client_email: serviceAccount.client_email,
private_key: serviceAccount.private_key,
quota: { rpmRetry: true },
})
.then(console.log)
.catch(console.error);
Licensing and Sponsorship
This project is available under the MIT License and is sponsored by SEO Gets, a company dedicated to optimizing your web presence.