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
![](https://www.devopsfreelancer.com/blog/wp-content/uploads/2023/07/image-84-1024x328.png)
![](https://www.devopsfreelancer.com/blog/wp-content/uploads/2023/07/image-85-1024x395.png)
After create project enable Google Analytics API
![](https://www.devopsfreelancer.com/blog/wp-content/uploads/2023/07/image-87-1024x373.png)
![](https://www.devopsfreelancer.com/blog/wp-content/uploads/2023/07/image-88-1024x377.png)
Click on service account and put your name as you want.
![](https://www.devopsfreelancer.com/blog/wp-content/uploads/2023/07/image-89-1024x406.png)
After creating service account go to key section to download json key
![](https://www.devopsfreelancer.com/blog/wp-content/uploads/2023/07/image-90-1024x363.png)
Now click on json
![](https://www.devopsfreelancer.com/blog/wp-content/uploads/2023/07/image-92-1024x399.png)
Now your Google Analytics API has been activated successfully. 👍👍