How to Create a Google Client ID and Client Secret for Google Analytics 4?
Note: To integrate with Google Analytics 4, please update Convert Pro plugin to v1.7.7 and Convert Pro Addon plugin to v1.5.6.
Step 1: Setup the Project
- Visit and register your website on Google at https://console.developers.google.com/
- You will need to be logged in with your Google Credentials.
- If you don’t have a project yet, you will need to create one by clicking on the blue Create Project button on the right side. While if you already have a project click on the name of your project in the dashboard instead, which will open a modal and click on New Project.
- Click the Create Button
- Name your Project, and click on Create again on the top right corner of the modal.
- Once you have a Project you will end up in the Dashboard.
Step 2: Setup the Credentials
- Select the OAuth consent Screen in the Dashboard below Credentials from the right sidebar!
- Let the default Application Type be Public. Enter a suitable name for your Application under the “Application name”, which will appear as the app asking for consent later on.
- Add relevant information in the below fields.
- Fill out the “Authorized domains” field with your domain name probably: your-site-url.com without any https in the beginning and subdomains in the end.
- Press Save and you will be redirected to the Credentials screen. Make sure all fields are filled out otherwise the Save button won’t work.
Step 3: Setup the OAuth credentials
- Redirected to the Consent screen click on the Create credentials button in the center of the page.
- It will open up a dropdown, select the OAuth Client ID.
- In the next screen, you will have multiple Application Type for the applications which use OAuth ID. You must select the Application Type as Web Application.
- You will see new options below, start with the Name of your Application.
- Add the Authorized redirect URI as https://your-site-url.com/wp-admin/admin.php?page=convert-pro-general-settings
- Now, click on the Create Button.
- A modal should pop up with your credentials. If it doesn’t open, go to the Credentials tab in the left-side bar and select your app by clicking on the name you entered. You will be able to copy the Client ID from here.
Enable Required Google Analytics API
- Google Analytics API
- Google Analytics Admin API
- Google Analytics Data API
Now, you need to enable these APIs for this project to work. First, hover over APIs and Services in the navigation menu on the left and click Library.
Type Google Analytics API in the search box and click on the result.
On the next page, click on Enable API button.
Repeat the same steps for the remaining APIs.
You need to add below scopes to your project from OAuth Consent Screen -> Scopes tab -> Add/Remove Scopes.
Setup Google Analytics integration in Convert Pro Dashboard
Go to Convert Pro -> Settings -> Analytics tab and under the Step – 2, you will have to enter the Client ID and Client Secret got in the first step and save.
- After saving the details, you will see next step – Step 3 in which you can authorize Convert Pro by clicking this link. –
- It will redirect you to consent screen. Make sure to use the email ID you are using to authenticate here is added in your GA4 property access management. Please refer this article.
- After authenticating you will be redirected back to Convert Pro settings screen again, but this time you will get an Access Code autofilled here –
- Then, click on Next button and after the authorization you will see the Google Analytics 4 properties associated with your account here
- Select the property you want to fetch the data from and click on Save.
- Now, you are connected to your selected Google Analytics 4 property –