If you want to build a custom report or dashboard for your Google Analytics data in your app or website, you have to use the Google Analytics Data API v1. In this beginner tutorial, you’ll learn about the OAuth process and query the GA4 property data programmatically.
Before beginning, make sure you have this:
A Google Analytics account with a property set up
A basic knowledge of REST APIs in Python.
Accessing GA4 data using Google Analytics Data API v1
Step 1: Create a cloud project
Open the Google Cloud Console using the link https://cloud.google.com/
Log in using your mail ID
Click console on the top right corner and click ‘My first Project’, and create a new project with all necessary data
Step 2: Create client OAuth 2.0
In this, we'll get a client ID and secret. Both datasets will be used for later authentication purposes.
Search for ‘ Google OAuth Platform’ and click
Click clients and click ‘Get Started’.…