Skip to content Skip to navigation
Back to the main support

Connect your WordPress site with Google Analytics

SEOPress PRO is required to view your Google Analytics stats from your WordPress dashboard.

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
Google Console Analytics Api
Google Console Analytics Api
Google Analytics Data API - Cloud Console
Google Analytics Data API – Cloud Console

Then click the blue Manage button.

Depending on your current settings, if you don’t get this screen, go to the next step “Create your Credentials“.

Choose “External” and click Create button.

OAuth consent screen - Google Cloud Console
OAuth consent screen – Google Cloud Console

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.

First step to create the OAuth consent screen - Google Cloud Console
First step to create the OAuth consent screen – Google Cloud Console

Create your credentials

From the left menu, click Credentials (do not use the button Create credentials from the right).

Google Analytics - Manage API
Google Analytics – Manage API

In Credentials page, click Create credentials blue button, and choose OAuth client ID.

  • Check Web application

    Google Analytics Manage Api - Web Application
    Google Analytics Manage Api – 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.
Google Analytics - Credentials
Google Analytics – Credentials

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.

Google Console Analytics API
Google Console Analytics API

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: