Connect your WordPress site with Google Analytics

Since SEOPress 1.5, you can view your Google Analytics Stats in your WordPress Dashboard.

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.

In API Manager, choose Library, search for Analytics API (be sure to activate the right API), click on Google Analytics API and activate it.

Google Console Analytics Api
Google Console Analytics Api

 

Google Console Analytics Api
Google Console Analytics Api

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

Check Website application, enter a name, like Google Analytics SEOPress,
enter your complete domaine name in Authorized JavaScripts (eg: https://www.yourdomainname.com),
and in Redirect URI, enter your URL like that https://www.yourdomainname.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.

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à!

Domain verification

Since July 2019, it is now necessary to validate your domain name.

To do this, go to the left hamburger menu, APIs and Services, Domain verification.

Click Add domain and enter your domain name.

Note that it must also be validated in Google Search Console.

Wait 1 or 2 minutes and you should be able to finish the setup.

Google Console - Domain verification page
Google Console – Domain verification page

Last modified: November 21, 2019