Stop! Can I have your attention for a moment?

Do you want to change your life? Join me on my 50-Day Life Transformation Challenge. Get involved! It won't cost you anything except a few bad habits.

Plausible Analytics: Integrate Google Search API

Plausible Analytics Google Search Console Connection

I already wrote about how great Plausible is as an alternative to Google Analytics a few days ago in this article. Today I want to show you how to integrate Google Search Console to see what keywords users are using to land on your site.

Briefly, this article is part of a series on Plausible Analytics. In part one, I'll show you how to set up Plausible on a DigitalOcean Droplet. In the following articles of this series, I will set up conversion tracking and integrate Plausible step by step deeper into the site.

Subscribe to my newsletter and I will inform you as soon as there are interesting news about this.

Steps to integrating the Google Search API into a self-hosted Plausible environment:

  1. Create your page in Google Search Console
  2. Verify your domain
  3. Google Cloud Console: create project & create OAuth key
  4. Customize plausible configuration & Restart container
  5. Start authentication
  6. List search terms

Create your page in Google Search Console

First, you'll need access to Google Search Console, which you can set up here: https://search.google.com. Once created and logged in there, you can then add your website in the next step. Google calls this "Property".

To do this, click on the "Add Property" link at the top of the dropdown.

Select which type of property to create

Verify your domain

Google wants to make sure that the domain is actually yours. For this, there is the possibility that you add a so-called TXT entry to your DNS settings

Google Cloud Console: create project & create OAuth key

Now to get access to the Google Search Console data, you first need access to it. To get this you need to create a new project for your Plausible environment in the Google Developer Console (https://console.developers.google.com/).

You can do this by clicking on the dropdown icon at the top next to the Google APIs logo and clicking "New Project" there.

It may take a few minutes for your project to be created and available. When it is, select your project and then choose "Login data" from the left side menu. There you will create new credentials of type "OAuth Client ID".

In the next step, you will be asked by Google for which application type you want to create the data. Here, you'll select the "web application" option. Enter a name for the web application.

The important thing to note here is the "Authorized Forwarding URIs" field. Here you need to enter the URL to your Plausible environment followed by "/auth/google/callback", for example:

https://plausible.example.com/auth/google/callback

Make sure the URL is correct, otherwise you will not be able to authenticate in the later step.

Google API Console: Enter correct OAuth return URL

 

Customize plausible configuration & Restart container

Now you need to enter in the plausible-conf.env the Google Client ID and Secret Key you created earlier:

ADMIN_USER_EMAIL=<admin-email>
ADMIN_USER_NAME=<admin-user>
ADMIN_USER_PWD=<admin-pw>
BASE_URL=<base-url>
SECRET_KEY_BASE=<secret-base-key>
GOOGLE_CLIENT_ID=<client-id>
GOOGLE_CLIENT_SECRET=<secret-key>

Now all you have to do is restart your Plausible container:

docker-compose halt
docker-compose up -d

Start authentication

Once your Plausible Docker container is restarted you will need to authenticate with your site via OAuth to Google Authentication:

To do this, go to the page overview, select the setting for the desired page, and click on "Search Console" in the left-hand page menu.

Connect Plausible with Google Search API

 

If your settings were correct up to this point, you'll see a "Continue with Google" button there. Clicking it will redirect you to Google authentication. Log in here with your Google credentials and confirm them in the next step.

If the login was successful you will be redirected to your page settings in where you can select the properties stored in the Google Search Console. Here you can select your page, which you have previously created in step 1.

The next step is to select your page.

Now you only need to save the setting → done!

List search terms

Now you can click on "Google" under "Top Sources" on the overview page and you will get the search terms listed with which the visitors came to your page.

Important note: The Google Search Console updates the data every 12 to 24 hours. Unfortunately, they are not displayed live but with a corresponding delay.

 

Comments

Subscribe to my Newsletter

Join a growing community of friendly readers. From time to time I share my thoughts about rational thinking, productivity and life.