---
title: Connect your WordPress site with Google Analytics
url: "https://www.seopress.org/support/guides/connect-wordpress-site-google-analytics/"
lang: en-US
updated: 2024-08-09
---

# Connect your WordPress site with Google Analytics

[**SEOPress PRO**](https://www.seopress.org/wordpress-seo-plugins/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](https://console.developers.google.com/).

*Note that you must first create a Google Console project before you can follow this tutorial. [More info on the official documentation](https://cloud.google.com/resource-manager/docs/creating-managing-projects). *

## 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](https://www.seopress.org/wp-content/uploads/2020/02/google-console-analytics-api-2.jpg)

*Google Console Analytics Api*

[![Google Analytics Data API - Cloud Console](https://www.seopress.org/wp-content/uploads/2017/01/google-analytics-data-api.png)](https://www.seopress.org/wp-content/uploads/2017/01/google-analytics-data-api.png)

*Google Analytics Data API – Cloud Console*

Then click the blue **Manage button**.

## Create the OAuth consent screen

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](https://www.seopress.org/wp-content/uploads/2017/01/google-analytics-google-cloud-user-consent-1.png)](https://www.seopress.org/wp-content/uploads/2017/01/google-analytics-google-cloud-user-consent-1.png)

*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](https://www.seopress.org/wp-content/uploads/2017/01/google-analytics-google-cloud-user-consent-2.png)](https://www.seopress.org/wp-content/uploads/2017/01/google-analytics-google-cloud-user-consent-2.png)

*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](https://www.seopress.org/wp-content/uploads/2020/02/google-analytics-manage-api.jpg)](https://www.seopress.org/wp-content/uploads/2020/02/google-analytics-manage-api.jpg)

*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](https://www.seopress.org/wp-content/uploads/2020/02/google-analytics-manage-api-web-app.jpg)](https://www.seopress.org/wp-content/uploads/2020/02/google-analytics-manage-api-web-app.jpg) *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](https://www.seopress.org/wp-content/uploads/2020/02/google-analytics-manage-api-credentials.jpg)](https://www.seopress.org/wp-content/uploads/2020/02/google-analytics-manage-api-credentials.jpg)

*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](https://www.seopress.org/wp-content/uploads/2019/12/seopress-google-analytics-api-en.jpg)](https://www.seopress.org/wp-content/uploads/2019/12/seopress-google-analytics-api-en.jpg)

*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/](https://www.seopress.org/support/guides/google-indexing-api-with-seopress/)

If you still have the error, try to follow this video:

## Error 400: URI redirect mismatch

If you get this error when trying to sign in to your own Google Cloud application, it means you have not correctly configured the **Authorized JavaScripts origins** and / or the **Authorized Redirect URIs** at the step “[Create your credentials](https://www.seopress.org/support/guides/connect-wordpress-site-google-analytics/#create-your-credentials)“.

Make sure to use your own domain name. If your domain starts with `www` you must include this too.

[![Google Analytics - Credentials](https://www.seopress.org/wp-content/uploads/2020/02/google-analytics-manage-api-credentials.jpg)](https://www.seopress.org/wp-content/uploads/2020/02/google-analytics-manage-api-credentials.jpg)
