base on Script to get your site indexed on Google in less than 48 hours # 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. > [!IMPORTANT] > > 1. This script uses [Google Indexing API](https://developers.google.com/search/apis/indexing-api/v3/quickstart) and it only works on pages with either `JobPosting` or `BroadcastEvent` structured data. > 2. Indexing != Ranking. This will not help your page rank on Google, it'll just let Google know about the existence of your pages. ## 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 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`](https://console.cloud.google.com/apis/api/searchconsole.googleapis.com) and [`Web Search Indexing API`](https://console.cloud.google.com/apis/api/indexing.googleapis.com) 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 ``` ### Using the repository Clone the repository to your machine. ```bash git clone https://github.com/goenning/google-indexing-script.git cd google-indexing-script ``` Install and build the project. ```bash npm install npm run build npm i -g . ``` > [!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`. ## Usage <details open> <summary>With <code>service_account.json</code> <i>(recommended)</i></summary> Create a `.gis` directory in your home folder and move the `service_account.json` file there. ```bash mkdir ~/.gis mv service_account.json ~/.gis ``` Run the script with the domain or url you want to index. ```bash gis <domain or url> # example gis seogets.com ``` Here are some other ways to run the script: ```bash # 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> <details> <summary>With environment variables</summary> Open `service_account.json` and copy the `client_email` and `private_key` values. Run the script with the domain or url you want to index. ```bash GIS_CLIENT_EMAIL=your-client-email GIS_PRIVATE_KEY=your-private-key gis seogets.com ``` </details> <details> <summary>With arguments <i>(not recommended)</i></summary> Open `service_account.json` and copy the `client_email` and `private_key` values. Once you have the values, run the script with the domain or url you want to index, the client email and the private key. ```bash gis seogets.com --client-email your-client-email --private-key your-private-key ``` </details> <details> <summary>As a npm module</summary> You can also use the script as a [npm module](https://www.npmjs.com/package/google-indexing-script) in your own project. ```bash npm i google-indexing-script ``` ```javascript 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); ``` Read the [API documentation](https://jsdocs.io/package/google-indexing-script) for more details. </details> Here's an example of what you should expect: ![](./output.png) > [!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. ## Quota Depending on your account several quotas are configured for the API (see [docs](https://developers.google.com/search/apis/indexing-api/v3/quota-pricing#quota)). By default the script exits as soon as the rate limit is exceeded. You can configure a retry mechanism for the read requests that apply on a per minute time frame. <details> <summary>With environment variables</summary> ```bash export GIS_QUOTA_RPM_RETRY=true ``` </details> <details> <summary>As a npm module</summary> ```javascript 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) ``` </details> ## 📄 License MIT License ## 💖 Sponsor This project is sponsored by [SEO Gets](https://seogets.com) ![](https://seogets.com/og.png) ", Assign "at most 3 tags" to the expected json: {"id":"7263","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"