1. Home
  2. Knowledge Base
  3. SEO Suite
  4. How To Create a Google API Project For Connecting Search Console

How To Create a Google API Project For Connecting Search Console

In this article, we are going to show you how you can create a Google API project and use it to connect various Google products with Rank Math.

Rank Math OAuth Screen

If you’ve been using Rank Math for some time, you might have also used the Search Console integration. If you did, then you might have noticed that you use a Rank Math app to connect your Search Console Account with Rank Math and your website.

Here is a screenshot if you need a reminder.

We wanted to give people the flexibility to use their apps with Rank Math, and now that functionality is finally here. To do so, you will need to perform 2 steps.

First, you will create your own app inside the Google Developer Console, and then you will configure Rank Math to use the app with a custom filter that we’ve built.

If you are already using our Google Indexing API plugin, then you already have an app created. In that case, you can skip the first few steps where we create the App, and start with the part where we give specific permissions to the apps.

Important Note: Unless there is a very good reason to do so, we do not recommend creating your own app to work with Google APIs. Not only are they hard to create, they are hard to get approved by Google, and they are harder to maintain.

Unless you are an expert, or have significant resources to create and maintain your app, we recommend that you keep using the Rank Math App. We don’t store or process any of your data, just fetch it and display it on your website. You can read our privacy policy here.

With that out of the way, let us begin.

Create an App in the Google Developer Console

1 Head over to Google Developer Console and create a new project. Give the project an appropriate name so that you can remember why you created the app in the first place. We will name ours “Rank Math SEO” for simplicity.

Click the Create button to proceed.

Google API Create Project

2 On the next screen, you will see a bunch of options, which might be confusing. You might also see a notification of the creation of your project.

Google API Project Dashboard

Don’t be overwhelmed by the number of options. You just have to configure a couple. Click the “Go to APIs Overview” link present at the bottom of the middle section.

Google API Project Settings

Clicking the link will open the APIs and Services your app is allowed to access. Since this is a new project, you will see nothing there.

3 Click the “Enable APIs and Services” link in the section to proceed.

Google API Enable APIs

Here you can find all the APIs that you connect with your app. Use the search bar to find the Google Search Console API.

Google API Search

4 Once you see the API, click on it to open its details.


5 On the details page, click the Enable to enable this API inside your app.

Google API GSC Enable APIs

You will return to the project overview page, and you will see that the Search Console API has been added to the project.

Currently, Rank Math only shows Google Search Console data, but in the future, we may add support for other Google products like Google AdSense or Google Analytics. We recommend that you add those APIs to this project as well to avoid issues in the future.

Google API GSC Dashboard

The process for adding APIs is the same for other Google products. First, head over to the APIs and Services section.

Google API Back to Project Dashboard

Then search for the relevant APIs. We recommend adding the Google Analytics Reporting API, Google Adsense Host API, and the Site Verification API.

Have a look at the images below for reference and add them to the app.

Here is how the Google Analytics Reporting API will appear.

Google API Analytics API

This is how the AdSense Host API will appear.

Google API Adsense API

And this is how the Site Verification API will appear.

Google API Site Verification API

Once you’ve added all the APIs to the app, the next step is to set up a consent screen.

6 The consent screen is where the users can see what kind of data they are allowing the app to access and whether they approve the action. It is similar to the consent screen we shared at the beginning of the article. The difference is that once you set it up, you will see your app requesting the permissions instead of Rank Math.

7 Head back to the project dashboard, then head to OAuth Consent Screen. Once you’re there, you will need to provide the name of the app (which is asking for consent), and a logo, which will be visible to you or your clients.

Google API OAuth Consent

Even though we’ve already added the APIs that we want to use with the app, we still need to configure the scope of the data that our app will pull with the API. This needs to be done as a single application can request different levels of access from a single API.

This feature is literally called Scopes inside Google Developer Console.

8 On the same Consent screen page, you will see the Scopes setting, click Add Scope.

Google API OAuth Add Scope

You will see scopes from all the APIs that you’ve added to the application.

9 Select all the scopes that are available, and click Add.

Google API OAuth Select Scopes

You will see a warning similar to the one shown below. That is expected. Since you are accessing sensitive data from your app users, Google needs to verify your consent screen before it is made available to use. The process can take a few days, during which your app will be limited to 100 logins of the sensitive scope.

Google API Scope Verification

10 In the next step, you need to provide the various links to your app’s homepage, the privacy policy, TOS, and other important pages. It is important to know that Google only allows authorized domains to be used in this step. An authorized domain is simply a domain that you have proven to have the ownership of – steps to do so for a variety of hosts are mentioned here.

As you can see in the image, you need to enter the following information on the page. Note that all the policy pages must be hosted on the main, authorized domain.

  • Authorized Domain
  • Application Homepage Link
  • Privacy Policy Link
  • Link to TOS (optional, but recommended)

11 Click the Submit for verification button after adding the information to proceed.

Google API OAuth Submit For Verification

Now another popup will appear, where you need to submit more details explaining why do you need these sensitive scopes, these details will be verified by the reviewer.

Google API OAuth Verification Details

And you are done with creating your app. Now you just have to wait for a few days to get your app verified. You can continue using your app with some restrictions until the process is complete.

12 You’re not completely done. You still have to create credentials to authorize your website to access the app. To do that, you will need to access the Credentials tab. There, you will need to click the + Create Credentials link on the top of the page.

Google API Create Credentials

13 From the available options, choose the OAuth Client ID. This is required as you will ask your user consent and access data on their behalf.

Google API OAuth Client ID

14 On the screen that appears, choose the Other option in the application type, as it does not fit in any of the other categories. Also, give it a suitable name, and then click Create.

Google API Save OAuth Client ID

The OAuth Client will be created, and you will be presented with a Client ID and a Client Secret. These keys should be private, so please do not share them anywhere.

Instead, copy them and save them on your computer temporarily.

Google API OAuth Client Credentials

Configure Rank Math to use Your App

You’ve created and configured your app. Now all you need to do is configure Rank Math to use your app to connect with Google services. To do that easily, we’ve created a filter inside Rank Math. Here is a sample code for the filter.

 * Filter to replace Rank Math App
	function( $config ) {
		$config['application_name'] = 'Rank Math';
		$config['client_id']        = 'xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com';
		$config['client_secret']    = 'xxxxxxxx-xxxxxxxxxxxxxxxxx';
		return $config;

You need to configure 3 things inside the filter.

  • application_name: Replace with the name of your application
  • client_id: Replace with the Client ID that you created in the step above
  • client_secret: Replace with the Client Secret that you created in the step above

Once you do, you will need to add this filter to your theme’s functions.php file. There are 2 ways to do so; directly and by using a plugin. Let us explain both of these options.

Adding the Filter to the Theme’s File Manually [Not Recommended]

We don’t recommend it for 2 reasons. First, you can end up breaking your website, and second, if you change your theme or even update it, your changes will be lost.

WordPress lets you edit your theme files from the admin area. To do that, you have to navigate to Appearance > Theme Editor.

WordPress Theme Editor

This option lets you change the code of your theme directly at its source.

We recommend that you create a child theme first and make your edits to the child theme. That way, your changes will persist, even if you update your theme. Here is an article that explains how to create a child theme.

After creating a child theme, head back to the Theme Editor inside WordPress. Once you’re there, look for the functions.php file from the file-hierarchy on the right.

Click on it to open it.

WordPress Edit functions.php file

Once the file is open, scroll to the end of the file, and paste the filter code just after the last ending curly bracket. Then, click the Update File button.

WordPress Add code in functions.php

And you should be done.

Using a Plugin to Add the Code [Recommended]

With WordPress, you know that you can find a plugin to achieve almost anything. Adding code to your website is no different. There are several plugins available that can do the job. For this demonstration, we will use the Code Snippets plugin.

  1. Search for the plugin “Code Snippets” inside your WordPress’ plugins area and install it on your website.
  2. Once installed, head over to WordPress Sidebar >> Snippets > Add New from the WordPress menu
  3. On the next page, you need to do some basic steps. Give your snippet a name, add the snippet code with the information from your app, and configure the snippet to run only in the backend (look at the screenshot). Once you make those changes, hit the Save Changes and Activate button.

Once activated, your website will behave as if the code was included in your theme’s functions.php file, just as it was with the actual code. The benefit here is that this way, the code changes are easier to manage, and you can even change or update themes without having to add it again.

Testing Your App with Rank Math

To test if your app configuration works perfectly, you can try to connect your app with Google Search Console and fetch some data. If the data comes through, you followed the steps perfectly.

From Rank Math’s menu, head over to the General Settings, then head over to the Search Console section. Click the Get Authorization Code button to authorize Rank Math to fetch your search console data.


A consent screen should appear on the screen, confirming that you want to allow a 3rd part app to access your data. If the app on the consent screen is your app, then everything works perfectly.

If you see an error, retrace your steps and figure out where the problem is. You can also contact us, and we will help you in any way we can. If you’d like to learn more about the verification process and connecting Google apps with Rank Math, we recommend you read our knowledge base article on Rank Math’s integration with Search Console. There we discuss how to verify your website, connect with the right Search Console profile, and many other important details.

Was this article helpful?

Still need help?


Submit Your Question

Please give us the details, our support team will get back to you.

Open Ticket

Related Articles