When needed, you can use your own Google Analytics API Project to authorize the Analytics Insights plugin.
This option is suitable for web developers, for websites generating a huge amount of API requests (huge websites/huge networks), or for education purposes.
- a free Google Analytics 4 account
- Analytics Insights for Google Analytics plugin
- a free Google Cloud console account
Creating your own Google API project
Go to cloud.google.com and click on Go to console button.
From the top left corner click on Select a project drop-down list and press New project to create a new API project.
Give your project a suggestive name (e.g. Analytics Insights) and click on Create. Afterwards click on Select Project link from the top-right of the screen. From the APIs and services left menu select Enable APIs and services.
From the top-screen select + ENABLE APIS AND SERVICES and enable the following APIs, using Search for APIs and services:
- Google Analytics Data API
- Google Analytics Admin API
After enabling the needed APIs, from the left menu select oAuth consent screen. For User Type select External and click on Create. Enter the required information:
- for App name use Analytics Insights
- select User support email
- enter your email for Developer contact information
- for Application home page use: https://deconf.com
Click on SAVE AND CONTINUE.
Using ADD OR REMOVE SCOPES add the /auth/analytics.readonly scope.
For How will the scopes be used? enter a reason (e.g. API project used with Analytics Insights plugin for my example.com WordPress site). Click Update.
Click on Save and continue. On the next screen add your e-mail address as a Test User using the + ADD USERS button.
Afterwards, click Save and continue for the following screens and finally BACK TO DASHBOARD.
From the left menu select Credentials. Using + CREDENTIALS link create a new oAuth2 client ID. For Application type select Web application and for Authorized redirect URIs enter the following URI:
Replace example.com with your own domain, click on ADD URI, and then Create. Click on the newly created Web client. On the right screen the Client ID and Client Secret are displayed.
During Testing publishing status, the app will allow a maximum of 100 test users, and the authorization refresh tokens will expire after seven days. To make the API Project public, from the OAuth consent screen use the PUBLISH APP button to publish the application. You don’t need to verify it further since only a handful of users will access it.
Use your new Google API project with Analytics Insights
To use your own API Project, go to your WordPress admin screen. From the left menu, go to Analytics Insights -> General Settings, select enable developer mode, enter the above credentials (client id and client secret), and click on Authorize Plugin.
That’s it, you are now using Analytics Insights for Google Analytics plugin with your own Google API Project credentials!