Introduction

This post is geared towards completing the installation for the Google Analytics Post Pageviews plugin for WordPress. It is not straightforward and the provided instructions are either dated or lacking. Either way this consumed a lot of time to figure out due to the vague nature of documentation available everywhere.

Google Analytics Post Pageviews

Problem

No matter what you do, you keep getting the following error (or something like it if you are troubleshooting a similar issue):

400. That’s an error.

Error: redirect_uri_mismatch

The redirect URI in the request, http://yourWordPressWebSite.com/wp-admin/options-general.php?page=google-analytics-post-pageviews, does not match the ones authorized for the OAuth client. Visit https://console.developers.google.com/apis/credentials/oauthclient/825054562834407666210?project=404754253856 to update the authorized redirect URIs.

Pretty frustrating and bewildering error, especially if you have never done this before.

Prerequisites

In order to troubleshoot this problem accurately you must have the following items setup already (instructions as of 06/05/2017):

  1. Google analytics account: https://www.google.com/analytics/
  2. Google API – A google api project to use in conjunction with the “Google Analytics Post Pageviews” plugin: https://console.developers.google.com/apis/
  3. Analytics API – Enable the Analytics API for this project. You have to click on “Library” side menu item in order to access the available APIs (left side).

    There are a ton of APIs available – in this screen capture I filtered out all of the other APIs on purpose.

    Follow all of the instructions shown until it is enabled.

  4. Next you want to click on the “Credentials” side menu item in order to continue to the confusing part.

    1. Complete the instructions on the “OAuth consent screen”, which is very straight forward – just make sure to fill everything out the best you can.
    2. Complete the “Domain verification”, which is slightly tedious but easy to complete, just follow the steps.
    3. Go to the next section for setting up the Credentials which is the confusing part.

The confusing part

This is the part that has everyone scratching their heads for hours at a time. Let’s stop all that confusion here.

  1. Click on “Create credentials” to make a drop down menu appear
  2. Select “OAuth client ID”
  3. Select the “Web application” radio button
  4. Enter a name, you can name this whatever the heck you want
  5. Authorized redirect URIs – TADAHHHH!!! It’s that thing you couldn’t find and it’s the thing that the error above was saying you screwed up. Congrats, enter your proper URL. In the context of the “Google Analytics Post Pageviews” plugin – that URL is provided to you via the plugin and looks like this: http://yourWordPressWebSite.com/wp-admin/options-general.php?page=google-analytics-post-pageviews (FYI: You are allowed to enter multiple URLs)
  6. Hit the create button

Final result


After pressing the create button you are presented with the above dialogue. Go ahead and copy that data respectively into the “Google Analytics Post Pageviews” plugin’s text fields. You can then test these values and you should be taken to the Google API dashboard. The following is example data:

  • Client Id: 576073251342-q9ueqg1d8igqbn5m5s53m2ihmk7mefds.apps.googleusercontent.com
  • Client secret: uhRBFdKcBN1BuEFho4ZoprUK

That’s all there is to it.

Relevant links

The following links are all related to the above, the answers provided hinted at what to do, but didn’t drive anything home in my opinion. Still good to review if this post didn’t help you.

Leave a Reply

Your email address will not be published. Required fields are marked *