Table of Contents
- 1. Extension Installation
- 2. Get Google Indexing API Details
- 3. Extension Configuration
- 4. Send Indexing Requests Manually
- 5. Monitor Indexing Requests
1. Extension Installation
For Magento Marketplace Customers
Find the extension’s Composer name and version in its composer.json file.
- Login to your SSH and run:
- composer require google/apiclient
- composer require meetanshi/magento-2-google-indexing-api
- Enter your authentication keys. Your public key is your username; your private key is your password.
- Wait for Composer to finish updating your project dependencies and make sure there aren’t any errors.
- To verify that the extension is installed properly, run the command:
- php bin/magento module:status Meetanshi_GoogleIndexingAPI
- By default, the extension is probably disabled. Enable the extension and clear static view files:
- php bin/magento module:enable Meetanshi_GoogleIndexingAPI --clear-static-content
- php bin/magento setup:upgrade
- For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
- For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
- php bin/magento cache:flush
For Meetanshi Customers
- First, install the Google API library by using the following command in the SSH:
- composer require google/apiclient
- Download the extension zip file and extract it to your Magento’s root directory.
- Login to your SSH and run below commands step by step:
- php bin/magento setup:upgrade
- For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
- For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
- php bin/magento cache:flush
2. Get Google Indexing API Details
The extension uses the Index API offered by the Google Cloud Console. Therefore, to use the extension, you’ll need to:
- Create a Service Account
- Enable the Google Indexing API & Generate JSON Key
- Add Service Account Email to Search Console
First, go to console.cloud.google.com and create a new project. If you do not have a cloud console account, you may required to sign up (it’s free).
Enter a project name and select an organization or folder that fits your preferences. Then click the Create button.
Once the project is created, navigate to Marketplace in the left pane, and search for Indexing API.
Enable the Web Search Indexing API for the project if it’s not enabled.
Once the API is enabled, go to Credentials in the left pane and click Create Credentials > Service account.
Name the service account as per your preferences (for e.g., Indexing requests) and assign the Owner role to the account.
Click Done to create it.
Open the created service account and go to Keys > Add Key > Create New Key and generate a JSON key for the service account.
The JSON key will be downloaded to your computer (you’ll need to upload it to the Magento extension for integration).
Now, you’ll need to add this service account email to your Google Search Console property. Copy the email from the service account details as shown below.
Open Google Search Console, go to Settings > Users and permissions, and click Add User.
Paste the copied service account email in the email address field, select Owner permission, and save it
Now, you’ve successfully granted permissions to your Google Cloud Console account and will be able to submit indexing requests via API using the downloaded key file.
3. Extension Configuration
Once the extension is installed in your store, go to Stores > Configuration > Meetanshi and select Google Indexing API.
3.1 API Integration
- Extension Status: Change the status to enable the extension.
- Request Delay: Set the delay in minutes to keep between each indexing request to prevent hitting the API limits. This works for both automated and manual requests.
Next, upload the Google Service account key JSON file that you downloaded.
Click the Save button to save the progress.
3.2 Automatic Indexing Settings
You can choose to send automatic indexing requests on content updates.
- Send Indexing Requests on Content Update: Set it to Yes to enable auto-indexing requests.
- Page Types: You can choose from the following types of pages for auto-indexing:
- CMS Pages
- Product Pages
- Category Pages
For the product pages, you can also choose the product attributes that you want to monitor for indexing requests. For example, the extension will send an indexing request to Google if the selected attribute value changes.
3.3 Set Requests Log Lifetime
Each indexing request you trigger is recorded in the Schedule Log. To manage storage and remove outdated entries, you can set the Indexing Schedule Log Lifetime (in days). Logs will be automatically cleared after the specified period.
Once you’re done with all the configuration, click the Save button.
4. Send Indexing Requests Manually
You can also submit products, pages, and URLs for indexing manually. The extension adds a Request Google Indexing option on the top menu bar in the product/page edit sections. Further, you can also select multiple entries and bulk submit for indexing.
4.1 Submit a Product/Page for Indexing
Edit the product or page you want to submit for indexing and click the Request Google Indexing option in the top bar.
4.2 Send Multiple Products for Indexing
In the products grid, select multiple products and open the Actions drop-down. Click the Request Google Indexing option.
4.3 Send Indexing Requests in Bulk
Using the extension, you can submit a list of URLs for indexing requests.
In the left menu bar, go to Content > Google Indexing API > Manual Request Submission.
Here, you can send two types of requests for URLs in bulk:
- Submit URLs to Index
- Remove URLs from the Index
In the URLs field, you can add a list of URLs (one URL in each line) or upload a txt file containing the URLs.
Once done, click Save to submit the indexing request in bulk.
5. Monitor Indexing Requests
Both manual and automated indexing requests are scheduled by the extension, which is executed on a cron job. You can view the status of these requests through the Content > Google Indexing API > Request Log grid.
In the log grid, you can view details like:
- URL for the indexing request
- Action type - URL update or deletion
- Status of the indexing request, i.e. pending or success
- Time of request creation, schedule, and executed time
In case of any error, you can refer to the message column in the indexing requests grid. You can also execute the pending requests instantly using the Execute Now action.