First, disable your antivirus software (Bitdefender, Norton, Kaspersky if you have one). Customers have reported conflicts and blocking during the connection between Google Console and your site. Reactivate them after following this tutorial.
Sign in to Google Cloud Console
To do that, we connect to Google Analytics API and make calls to get datas with a Client ID and a Secret ID.
To generate your credentials, you have to login to Google Console.
Note that you must first create a Google Console project before you can follow this tutorial. More info on the official documentation.
Enable the required Google APIs
In API Manager, choose Library, search for the APIs listed below, and activate them one by one:
- Google Analytics API
- Google Analytics Data API
Then click the blue Manage button.
Create the OAuth consent screen
Choose “External” and click Create button.
At the first step, fill in all the required fields. The values doesn’t really matter. Only you will see this when doing the connection between your WP site and your Google Cloud account.
- App name
- User support email
- Developer contact information email
Click Save and continue button.
At second step, change nothing and click Save and continue button.
Same for the third step.
At the final step, click Back to Dashboard to continue with Credentials step.
Create your credentials
From the left menu, click Credentials (do not use the button Create credentials from the right).
In Credentials page, click Create credentials blue button, and choose OAuth client ID.
- Check Web application
- enter a name, like Google Analytics SEOPress,
- enter your complete domaine name in Authorized JavaScripts origins (replace with your own domain name):
https://www.example.com
- and in Authorized Redirect URIs, enter your URL like that (replace with your own domain name):
https://www.example.com/wp-admin/admin.php?page=seopress-google-analytics
- and Create.
Note that before clicking Create, make sure the 2 URLs are saved by Google. When you enter your URL, click outside the field to validate it.
If your domain name is WITHOUT “www”, do NOT enter “www” in Authorized JavaScripts and Redirect URI fields.
Then copy and paste Client ID and Secret ID from the popup to your WordPress admin, SEOPress, Google Analytics, Stats in Dashboard Google Console Client ID/Google Console Secret ID.
Make sure to select these codes without spaces at the beginning and end to avoid an error.
Don’t forget to save.
Now you can click Connect with Google Analytics, grant access and voilà!
Error 403: access_denied
If you get this error: “The developer hasn’t given you access to this app. It’s currently being tested and it hasn’t been verified by Google.“, make sure to use the same Google account for Analytics and Cloud Console.
If not possible, you will have to create a service account from Cloud Console then add the email generated to your Google Analytics account.
This guide explains this procedure for Indexing API but this is exactly the same thing:
https://www.seopress.org/support/guides/google-indexing-api-with-seopress/
If you still have the error, try to follow this video: