What is Google Analytics API ?
Google Analytics API is a set of programming interfaces that allows developers to interact with and access data from Google Analytics programmatically. Google Analytics is a web analytics service offered by Google that tracks and reports website traffic and user interactions. The API provides a way for developers to retrieve data and integrate Google Analytics data into their own applications, services, or websites.
First go enable Google analytics
First open this url :- https://console.cloud.google.com/apis/library
Create new project


After create project enable Google Analytics API


Click on service account and put your name as you want.

After creating service account go to key section to download json key

Now click on json

Now your Google Analytics API has been activated successfully. 👍👍